Remove trailing whitespace.
Also adds a presubmit to prevent adding trailing whitespace to source code in the future. Change-Id: I41a4df81487f6f00aa19b188f0cac6a3377efde6 Reviewed-on: https://skia-review.googlesource.com/57380 Reviewed-by: Ravi Mistry <rmistry@google.com> Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
This commit is contained in:
parent
a49909aa24
commit
63fd760a37
@ -225,6 +225,9 @@ def _CommonChecks(input_api, output_api):
|
||||
results.extend(
|
||||
input_api.canned_checks.CheckChangeHasNoCR(
|
||||
input_api, output_api, source_file_filter=sources))
|
||||
results.extend(
|
||||
input_api.canned_checks.CheckChangeHasNoStrayWhitespace(
|
||||
input_api, output_api, source_file_filter=sources))
|
||||
results.extend(_PythonChecks(input_api, output_api))
|
||||
results.extend(_IfDefChecks(input_api, output_api))
|
||||
results.extend(_CopyrightChecks(input_api, output_api,
|
||||
|
@ -98,7 +98,7 @@ protected:
|
||||
const SkImageFilter::CropRect cropRect(bmpRect.makeInset(10.f, 10.f));
|
||||
const SkImageFilter::CropRect cropRectLarge(bmpRect);
|
||||
|
||||
sk_sp<SkImageFilter> input = fIsExpanded
|
||||
sk_sp<SkImageFilter> input = fIsExpanded
|
||||
? SkOffsetImageFilter::Make(0, 0, nullptr, &cropRect)
|
||||
: nullptr;
|
||||
|
||||
|
@ -102,7 +102,7 @@ GrGLuint GLBench::CompileShader(const GrGLContext* context, const char* sksl, Gr
|
||||
return shader;
|
||||
}
|
||||
|
||||
GrGLuint GLBench::CreateProgram(const GrGLContext* context, const char* vshader,
|
||||
GrGLuint GLBench::CreateProgram(const GrGLContext* context, const char* vshader,
|
||||
const char* fshader) {
|
||||
const GrGLInterface* gl = context->interface();
|
||||
GrGLuint vertexShader = CompileShader(context, vshader, GR_GL_VERTEX_SHADER);
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
void onPreDraw(SkCanvas* canvas) override {
|
||||
// Left to right
|
||||
SkPoint points[2] = {
|
||||
SkPoint::Make(0, kSize/2),
|
||||
SkPoint::Make(0, kSize/2),
|
||||
SkPoint::Make(kSize-1, kSize/2),
|
||||
};
|
||||
|
||||
|
@ -19,7 +19,7 @@ public:
|
||||
HardStopGradientBench_ScaleNumHardStops(int colorCount, int hardStopCount) {
|
||||
SkASSERT(hardStopCount <= colorCount/2);
|
||||
|
||||
fName.printf("hardstop_scale_num_hard_stops_%03d_colors_%03d_hard_stops",
|
||||
fName.printf("hardstop_scale_num_hard_stops_%03d_colors_%03d_hard_stops",
|
||||
colorCount, hardStopCount);
|
||||
|
||||
fColorCount = colorCount;
|
||||
@ -37,7 +37,7 @@ public:
|
||||
void onPreDraw(SkCanvas* canvas) override {
|
||||
// Left to right
|
||||
SkPoint points[2] = {
|
||||
SkPoint::Make(0, kSize/2),
|
||||
SkPoint::Make(0, kSize/2),
|
||||
SkPoint::Make(kSize-1, kSize/2),
|
||||
};
|
||||
|
||||
|
@ -84,7 +84,7 @@ public:
|
||||
};
|
||||
|
||||
SkScalar* positions = fKind == Kind::k001 ? pos_001 :
|
||||
fKind == Kind::k011 ? pos_011 :
|
||||
fKind == Kind::k011 ? pos_011 :
|
||||
pos_centered;
|
||||
|
||||
int count = fKind == Kind::kCentered ? 4 : 3;
|
||||
@ -109,7 +109,7 @@ private:
|
||||
int fW;
|
||||
int fH;
|
||||
Kind fKind;
|
||||
SkPaint fPaint;
|
||||
SkPaint fPaint;
|
||||
};
|
||||
|
||||
DEF_BENCH(return new HardStopGradientBench_SpecialHardStops(100, 100, Kind::k001););
|
||||
|
@ -657,7 +657,7 @@ protected:
|
||||
|
||||
private:
|
||||
const char* fName;
|
||||
|
||||
|
||||
typedef Benchmark INHERITED;
|
||||
};
|
||||
DEF_BENCH( return new Floor2IntBench(false); )
|
||||
|
@ -33,7 +33,7 @@ sk_sp<SkPicture> SkDebugger::copyPicture() {
|
||||
// We can't just call clone here since we want to removed the "deleted"
|
||||
// commands. Playing back will strip those out.
|
||||
SkPictureRecorder recorder;
|
||||
SkCanvas* canvas = recorder.beginRecording(this->pictureCull().width(),
|
||||
SkCanvas* canvas = recorder.beginRecording(this->pictureCull().width(),
|
||||
this->pictureCull().height());
|
||||
|
||||
bool vizMode = fDebugCanvas->getMegaVizMode();
|
||||
|
@ -85,7 +85,7 @@ public:
|
||||
return fDebugCanvas->getCurrentClip();
|
||||
}
|
||||
|
||||
SkRect pictureCull() const {
|
||||
SkRect pictureCull() const {
|
||||
return fPicture ? fPicture->cullRect() : SkRect::MakeEmpty();
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
#import "HelloWorldNSView.h"
|
||||
|
||||
#include "SkApplication.h"
|
||||
#include <crt_externs.h>
|
||||
#include <crt_externs.h>
|
||||
|
||||
@implementation HelloWorldNSView
|
||||
|
||||
|
@ -1,3 +1,10 @@
|
||||
/*
|
||||
* Copyright 2011 Google Inc.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#import "FileReaderWindow.h"
|
||||
#import "SkGradientShader.h"
|
||||
|
||||
@ -9,7 +16,7 @@ static void init_effects() {
|
||||
SkPoint pts[] = {p, q};
|
||||
SkColor colors[] = { SK_ColorRED, SK_ColorGREEN };
|
||||
SkScalar pos[] = { 0, 1.0};
|
||||
SkGradientShader::CreateLinear(pts, colors, pos, 2,
|
||||
SkGradientShader::CreateLinear(pts, colors, pos, 2,
|
||||
SkShader::kMirror_TileMode);
|
||||
}
|
||||
}
|
||||
@ -23,13 +30,14 @@ static void init_effects() {
|
||||
[fView addSkView:fReaderView];
|
||||
[fView setNeedsDisplay:YES];
|
||||
fReaderView->unref();
|
||||
//TODO - Temporary fix. Inval doesn't Seem to be working.
|
||||
[NSTimer scheduledTimerWithTimeInterval:0.01 target:self
|
||||
selector:@selector(redraw) userInfo:nil
|
||||
//TODO - Temporary fix. Inval doesn't Seem to be working.
|
||||
[NSTimer scheduledTimerWithTimeInterval:0.01 target:self
|
||||
selector:@selector(redraw) userInfo:nil
|
||||
repeats:YES];
|
||||
}
|
||||
|
||||
- (void)redraw {
|
||||
[fView setNeedsDisplay:YES];
|
||||
}
|
||||
@end
|
||||
@end
|
||||
|
||||
|
@ -60,22 +60,22 @@ int main(void) {
|
||||
if (!glfwInit()) {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
|
||||
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
|
||||
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
||||
glfwWindowHint(GLFW_SRGB_CAPABLE, GL_TRUE);
|
||||
|
||||
|
||||
window = glfwCreateWindow(kWidth, kHeight, "Simple example", NULL, NULL);
|
||||
if (!window) {
|
||||
glfwTerminate();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
glfwMakeContextCurrent(window);
|
||||
|
||||
|
||||
init_skia(kWidth, kHeight);
|
||||
|
||||
|
||||
sk_sp<SkImage> atlas;
|
||||
SkRSXform xform[kGrid*kGrid+1];
|
||||
SkRect tex[kGrid*kGrid+1];
|
||||
@ -87,13 +87,13 @@ int main(void) {
|
||||
atlas.reset(SkImage::NewFromEncoded(imageData.get()));
|
||||
if (!atlas) {
|
||||
SkDebugf("\nCould not decode file ship.png\n");
|
||||
|
||||
|
||||
cleanup_skia();
|
||||
glfwDestroyWindow(window);
|
||||
glfwTerminate();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
SkScalar anchorX = atlas->width()*0.5f;
|
||||
SkScalar anchorY = atlas->height()*0.5f;
|
||||
int currIndex = 0;
|
||||
@ -101,7 +101,7 @@ int main(void) {
|
||||
for (int y = 0; y < kGrid; y++) {
|
||||
float xPos = (x / (kGrid - 1.0)) * kWidth;
|
||||
float yPos = (y / (kGrid - 1.0)) * kWidth;
|
||||
|
||||
|
||||
tex[currIndex] = SkRect::MakeLTRB(0.0f, 0.0f, atlas->width(), atlas->height());
|
||||
xform[currIndex] = SkRSXform::MakeFromRadians(2.0f, SK_ScalarPI*0.5f,
|
||||
xPos, yPos, anchorX, anchorY);
|
||||
@ -111,12 +111,12 @@ int main(void) {
|
||||
tex[currIndex] = SkRect::MakeLTRB(0.0f, 0.0f, atlas->width(), atlas->height());
|
||||
xform[currIndex] = SkRSXform::MakeFromRadians(2.0f, SK_ScalarPI*0.5f,
|
||||
kWidth*0.5f, kHeight*0.5f, anchorX, anchorY);
|
||||
|
||||
|
||||
currentTime = 0;
|
||||
|
||||
|
||||
glfwSwapInterval(1);
|
||||
glfwSetKeyCallback(window, key_callback);
|
||||
|
||||
|
||||
// Draw to the surface via its SkCanvas.
|
||||
SkCanvas* canvas = sSurface->getCanvas(); // We don't manage this pointer's lifetime.
|
||||
SkPaint paint;
|
||||
@ -129,9 +129,9 @@ int main(void) {
|
||||
const float kSinDiff = 0.01745240643f;
|
||||
|
||||
timer.start();
|
||||
|
||||
|
||||
glfwPollEvents();
|
||||
|
||||
|
||||
float meanTime = 0.0f;
|
||||
for (int i = 0; i < 32; ++i) {
|
||||
meanTime += times[i];
|
||||
@ -140,39 +140,39 @@ int main(void) {
|
||||
char outString[64];
|
||||
float fps = 1000.f/meanTime;
|
||||
sprintf(outString, "fps: %f ms: %f", fps, meanTime);
|
||||
|
||||
|
||||
for (int i = 0; i < kGrid*kGrid+1; ++i) {
|
||||
SkScalar c = xform[i].fSCos;
|
||||
SkScalar s = xform[i].fSSin;
|
||||
|
||||
|
||||
SkScalar dx = c*anchorX - s*anchorY;
|
||||
SkScalar dy = s*anchorX + c*anchorY;
|
||||
|
||||
xform[i].fSCos = kCosDiff*c - kSinDiff*s;
|
||||
xform[i].fSSin = kSinDiff*c + kCosDiff*s;
|
||||
|
||||
|
||||
dx -= xform[i].fSCos*anchorX - xform[i].fSSin*anchorY;
|
||||
dy -= xform[i].fSSin*anchorX + xform[i].fSCos*anchorY;
|
||||
xform[i].fTx += dx;
|
||||
xform[i].fTy += dy;
|
||||
}
|
||||
|
||||
|
||||
canvas->clear(SK_ColorBLACK);
|
||||
canvas->drawAtlas(atlas, xform, tex, nullptr, kGrid*kGrid+1, SkXfermode::kSrcOver_Mode,
|
||||
nullptr, &paint);
|
||||
canvas->drawText(outString, strlen(outString), 100.f, 100.f, paint);
|
||||
|
||||
|
||||
canvas->flush();
|
||||
|
||||
|
||||
timer.end();
|
||||
times[currentTime] = (float)(timer.fWall);
|
||||
currentTime = (currentTime + 1) & 0x1f;
|
||||
|
||||
|
||||
glfwSwapBuffers(window);
|
||||
}
|
||||
|
||||
|
||||
cleanup_skia();
|
||||
|
||||
|
||||
glfwDestroyWindow(window);
|
||||
glfwTerminate();
|
||||
exit(EXIT_SUCCESS);
|
||||
|
@ -16,12 +16,12 @@
|
||||
#pragma mark -
|
||||
#pragma mark Application lifecycle
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
|
||||
// Override point for customization after application launch.
|
||||
|
||||
|
||||
[self.window makeKeyAndVisible];
|
||||
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
@ -16,12 +16,12 @@
|
||||
#pragma mark -
|
||||
#pragma mark Application lifecycle
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
|
||||
// Override point for customization after application launch.
|
||||
|
||||
|
||||
[self.window makeKeyAndVisible];
|
||||
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
|
||||
- (void)applicationDidEnterBackground:(UIApplication *)application {
|
||||
/*
|
||||
Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
|
||||
Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
|
||||
If your application supports background execution, called instead of applicationWillTerminate: when the user quits.
|
||||
*/
|
||||
}
|
||||
|
@ -1,3 +1,10 @@
|
||||
/*
|
||||
* Copyright 2011 Google Inc.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#import "SkOptionListController.h"
|
||||
|
||||
@implementation SkOptionListController
|
||||
@ -37,14 +44,14 @@
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
|
||||
|
||||
static NSString *CellIdentifier = @"Cell";
|
||||
|
||||
|
||||
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
|
||||
if (cell == nil) {
|
||||
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
|
||||
}
|
||||
|
||||
|
||||
cell.textLabel.text = [fOptions objectAtIndex:indexPath.row];
|
||||
if (indexPath.row == fSelectedIndex) {
|
||||
cell.accessoryType = UITableViewCellAccessoryCheckmark;
|
||||
@ -52,7 +59,7 @@
|
||||
}
|
||||
else
|
||||
cell.accessoryType = UITableViewCellAccessoryNone;
|
||||
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,10 @@
|
||||
/*
|
||||
* Copyright 2011 Google Inc.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#import "SkOptionsTableViewController.h"
|
||||
#include "SkEvent.h"
|
||||
#include "SkTArray.h"
|
||||
@ -52,8 +59,8 @@
|
||||
}
|
||||
|
||||
- (void)updateMenu:(SkOSMenu*)menu {
|
||||
// the first menu is always assumed to be the static, the second is
|
||||
// repopulated every time over and over again
|
||||
// the first menu is always assumed to be the static, the second is
|
||||
// repopulated every time over and over again
|
||||
int menuIndex = fMenus->find(menu);
|
||||
if (menuIndex >= 0 && menuIndex < fMenus->count()) {
|
||||
NSUInteger first = 0;
|
||||
@ -72,14 +79,14 @@
|
||||
for (int i = 0; i < menu->getCount(); ++i) {
|
||||
const SkOSMenu::Item* item = menuitems[i];
|
||||
NSString* title = [NSString stringWithUTF8String:item->getLabel()];
|
||||
|
||||
|
||||
if (SkOSMenu::kList_Type == item->getType()) {
|
||||
int value = 0;
|
||||
SkOptionListItem* List = [[SkOptionListItem alloc] init];
|
||||
|
||||
List.fItem = item;
|
||||
List.fOptions = [[SkOptionListController alloc] initWithStyle:UITableViewStyleGrouped];
|
||||
|
||||
|
||||
int count = 0;
|
||||
SkOSMenu::FindListItemCount(*item->getEvent(), &count);
|
||||
SkTArray<SkString> options;
|
||||
@ -88,7 +95,7 @@
|
||||
for (int i = 0; i < count; ++i)
|
||||
[List.fOptions addOption:[NSString stringWithUTF8String:options[i].c_str()]];
|
||||
SkOSMenu::FindListIndex(*item->getEvent(), item->getSlotName(), &value);
|
||||
|
||||
|
||||
List.fOptions.fSelectedIndex = value;
|
||||
List.fCell = [self createList:title
|
||||
default:[List.fOptions getSelectedOption]];
|
||||
@ -99,7 +106,7 @@
|
||||
else {
|
||||
SkOptionItem* option = [[SkOptionItem alloc] init];
|
||||
option.fItem = item;
|
||||
|
||||
|
||||
bool state = false;
|
||||
SkString str;
|
||||
SkOSMenu::TriState tristate;
|
||||
@ -116,18 +123,18 @@
|
||||
SkOSMenu::FindSliderValue(*item->getEvent(), item->getSlotName(), &value);
|
||||
SkOSMenu::FindSliderMin(*item->getEvent(), &min);
|
||||
SkOSMenu::FindSliderMax(*item->getEvent(), &max);
|
||||
option.fCell = [self createSlider:title
|
||||
min:min
|
||||
option.fCell = [self createSlider:title
|
||||
min:min
|
||||
max:max
|
||||
default:value];
|
||||
break;
|
||||
break;
|
||||
case SkOSMenu::kTriState_Type:
|
||||
SkOSMenu::FindTriState(*item->getEvent(), item->getSlotName(), &tristate);
|
||||
option.fCell = [self createTriState:title default:(int)tristate];
|
||||
break;
|
||||
case SkOSMenu::kTextField_Type:
|
||||
SkOSMenu::FindText(*item->getEvent(), item->getSlotName(), &str);
|
||||
option.fCell = [self createTextField:title
|
||||
option.fCell = [self createTextField:title
|
||||
default:[NSString stringWithUTF8String:str.c_str()]];
|
||||
break;
|
||||
default:
|
||||
@ -175,34 +182,34 @@
|
||||
|
||||
- (UITableViewCell*)createAction:(NSString*)title {
|
||||
UITableViewCell* cell = [[[UITableViewCell alloc]
|
||||
initWithStyle:UITableViewCellStyleValue1
|
||||
initWithStyle:UITableViewCellStyleValue1
|
||||
reuseIdentifier:nil] autorelease];
|
||||
cell.textLabel.text = title;
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (UITableViewCell*)createSwitch:(NSString*)title default:(BOOL)state {
|
||||
UITableViewCell* cell = [[[UITableViewCell alloc]
|
||||
initWithStyle:UITableViewCellStyleValue1
|
||||
UITableViewCell* cell = [[[UITableViewCell alloc]
|
||||
initWithStyle:UITableViewCellStyleValue1
|
||||
reuseIdentifier:nil] autorelease];
|
||||
cell.textLabel.text = title;
|
||||
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
UISwitch* switchView = [[UISwitch alloc] initWithFrame:CGRectZero];
|
||||
[switchView setOn:state animated:NO];
|
||||
[switchView addTarget:self
|
||||
action:@selector(valueChanged:)
|
||||
[switchView addTarget:self
|
||||
action:@selector(valueChanged:)
|
||||
forControlEvents:UIControlEventValueChanged];
|
||||
cell.accessoryView = switchView;
|
||||
[switchView release];
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (UITableViewCell*)createSlider:(NSString*)title
|
||||
min:(float)min
|
||||
max:(float)max
|
||||
- (UITableViewCell*)createSlider:(NSString*)title
|
||||
min:(float)min
|
||||
max:(float)max
|
||||
default:(float)value {
|
||||
UITableViewCell* cell = [[[UITableViewCell alloc]
|
||||
initWithStyle:UITableViewCellStyleValue1
|
||||
UITableViewCell* cell = [[[UITableViewCell alloc]
|
||||
initWithStyle:UITableViewCellStyleValue1
|
||||
reuseIdentifier:nil] autorelease];
|
||||
cell.textLabel.text = title;
|
||||
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
@ -210,18 +217,18 @@
|
||||
sliderView.value = value;
|
||||
sliderView.minimumValue = min;
|
||||
sliderView.maximumValue = max;
|
||||
[sliderView addTarget:self
|
||||
action:@selector(valueChanged:)
|
||||
[sliderView addTarget:self
|
||||
action:@selector(valueChanged:)
|
||||
forControlEvents:UIControlEventValueChanged];
|
||||
cell.detailTextLabel.text = [NSString stringWithFormat:@"%1.1f", value];
|
||||
cell.accessoryView = sliderView;
|
||||
cell.accessoryView = sliderView;
|
||||
[sliderView release];
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (UITableViewCell*)createTriState:(NSString*)title default:(int)index {
|
||||
UITableViewCell* cell = [[[UITableViewCell alloc]
|
||||
initWithStyle:UITableViewCellStyleValue1
|
||||
UITableViewCell* cell = [[[UITableViewCell alloc]
|
||||
initWithStyle:UITableViewCellStyleValue1
|
||||
reuseIdentifier:nil] autorelease];
|
||||
cell.textLabel.text = title;
|
||||
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
@ -229,44 +236,44 @@
|
||||
UISegmentedControl* segmented = [[UISegmentedControl alloc] initWithItems:items];
|
||||
segmented.selectedSegmentIndex = (index == -1) ? 2 : index;
|
||||
segmented.segmentedControlStyle = UISegmentedControlStyleBar;
|
||||
[segmented addTarget:self
|
||||
action:@selector(valueChanged:)
|
||||
[segmented addTarget:self
|
||||
action:@selector(valueChanged:)
|
||||
forControlEvents:UIControlEventValueChanged];
|
||||
cell.accessoryView = segmented;
|
||||
[segmented release];
|
||||
return cell;
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (UITableViewCell*)createTextField:(NSString*)title
|
||||
- (UITableViewCell*)createTextField:(NSString*)title
|
||||
default:(NSString*)value {
|
||||
UITableViewCell* cell = [[[UITableViewCell alloc]
|
||||
initWithStyle:UITableViewCellStyleValue1
|
||||
UITableViewCell* cell = [[[UITableViewCell alloc]
|
||||
initWithStyle:UITableViewCellStyleValue1
|
||||
reuseIdentifier:nil] autorelease];
|
||||
cell.textLabel.text = title;
|
||||
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
UITextField* textField = [[UITextField alloc]
|
||||
UITextField* textField = [[UITextField alloc]
|
||||
initWithFrame:CGRectMake(0, 10, 150, 25)];
|
||||
textField.adjustsFontSizeToFitWidth = YES;
|
||||
textField.textAlignment = NSTextAlignmentRight;
|
||||
textField.textColor = cell.detailTextLabel.textColor;
|
||||
textField.placeholder = value;
|
||||
textField.returnKeyType = UIReturnKeyDone;
|
||||
[textField addTarget:self
|
||||
action:@selector(valueChanged:)
|
||||
[textField addTarget:self
|
||||
action:@selector(valueChanged:)
|
||||
forControlEvents:UIControlEventEditingDidEndOnExit];
|
||||
cell.accessoryView = textField;
|
||||
cell.accessoryView = textField;
|
||||
[textField release];
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (UITableViewCell*)createList:(NSString*)title default:(NSString*)value{
|
||||
UITableViewCell* cell = [[[UITableViewCell alloc]
|
||||
initWithStyle:UITableViewCellStyleValue1
|
||||
UITableViewCell* cell = [[[UITableViewCell alloc]
|
||||
initWithStyle:UITableViewCellStyleValue1
|
||||
reuseIdentifier:nil] autorelease];
|
||||
cell.textLabel.text = title;
|
||||
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
|
||||
cell.detailTextLabel.text = value;
|
||||
return cell;
|
||||
return cell;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
@ -294,7 +301,7 @@
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
UITableViewCell* cell = [tableView cellForRowAtIndexPath:indexPath];
|
||||
id item = [fItems objectAtIndex:[self convertPathToIndex:indexPath]];
|
||||
|
||||
|
||||
if ([item isKindOfClass:[SkOptionListItem class]]) {
|
||||
SkOptionListItem* list = (SkOptionListItem*)item;
|
||||
self.fCurrentList = list;
|
||||
@ -306,7 +313,7 @@
|
||||
SkOptionItem* action = (SkOptionItem*)item;
|
||||
action.fItem->postEvent();
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
NSLog(@"unknown");
|
||||
}
|
||||
@ -317,8 +324,8 @@
|
||||
#pragma mark -
|
||||
#pragma mark Navigation controller delegate
|
||||
|
||||
- (void)navigationController:(UINavigationController *)navigationController
|
||||
willShowViewController:(UIViewController *)viewController
|
||||
- (void)navigationController:(UINavigationController *)navigationController
|
||||
willShowViewController:(UIViewController *)viewController
|
||||
animated:(BOOL)animated {
|
||||
if (self == viewController) { //when a List option is popped, trigger event
|
||||
NSString* selectedOption = [fCurrentList.fOptions getSelectedOption];
|
||||
@ -336,4 +343,5 @@
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
@end
|
||||
@end
|
||||
|
||||
|
@ -1,3 +1,10 @@
|
||||
/*
|
||||
* Copyright 2011 Google Inc.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#import "SkUIDetailViewController.h"
|
||||
#include "SampleApp.h"
|
||||
#include "SkCGUtils.h"
|
||||
@ -11,43 +18,43 @@
|
||||
[super viewDidLoad];
|
||||
|
||||
fSkUIView = (SkUIView*)self.view;
|
||||
|
||||
|
||||
fWind = (SampleWindow*)fSkUIView.fWind;
|
||||
fSkUIView.fTitleItem = self.navigationItem;
|
||||
|
||||
|
||||
[self createButtons];
|
||||
|
||||
|
||||
UISwipeGestureRecognizer* swipe = [[UISwipeGestureRecognizer alloc]
|
||||
initWithTarget:self
|
||||
initWithTarget:self
|
||||
action:@selector(handleSwipe:)];
|
||||
[self.navigationController.navigationBar addGestureRecognizer:swipe];
|
||||
[swipe release];
|
||||
swipe = [[UISwipeGestureRecognizer alloc]
|
||||
initWithTarget:self
|
||||
initWithTarget:self
|
||||
action:@selector(handleSwipe:)];
|
||||
swipe.direction = UISwipeGestureRecognizerDirectionLeft;
|
||||
[self.navigationController.navigationBar addGestureRecognizer:swipe];
|
||||
[swipe release];
|
||||
|
||||
fOptionsController = [[SkOptionsTableViewController alloc]
|
||||
|
||||
fOptionsController = [[SkOptionsTableViewController alloc]
|
||||
initWithStyle:UITableViewStyleGrouped];
|
||||
fSkUIView.fOptionsDelegate = fOptionsController;
|
||||
[fOptionsController registerMenus:fWind->getMenus()];
|
||||
|
||||
|
||||
}
|
||||
|
||||
- (void)createButtons {
|
||||
UIToolbar* toolbar = [[UIToolbar alloc]
|
||||
initWithFrame:CGRectMake(0, 0, 125, 45)];
|
||||
[toolbar setBarStyle: UIBarStyleBlackOpaque];
|
||||
|
||||
|
||||
UIBarButtonItem* flexibleSpace = [[UIBarButtonItem alloc]
|
||||
initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace
|
||||
target:nil
|
||||
action:nil];
|
||||
|
||||
|
||||
fOptionsButton = [[UIBarButtonItem alloc]
|
||||
initWithTitle:@"Options"
|
||||
initWithTitle:@"Options"
|
||||
style:UIBarButtonItemStylePlain
|
||||
target:self
|
||||
action:@selector(presentOptions)];
|
||||
@ -56,7 +63,7 @@
|
||||
target:nil
|
||||
action:nil];
|
||||
fixedSpace.width = 10;
|
||||
|
||||
|
||||
fPrintButton = [[UIBarButtonItem alloc]
|
||||
initWithBarButtonSystemItem:UIBarButtonSystemItemAction
|
||||
target:self
|
||||
@ -65,7 +72,7 @@
|
||||
|
||||
[toolbar setItems:[NSArray arrayWithObjects:flexibleSpace, fOptionsButton, fixedSpace, fPrintButton, nil]
|
||||
animated:NO];
|
||||
|
||||
|
||||
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]
|
||||
initWithCustomView:toolbar];
|
||||
[flexibleSpace release];
|
||||
@ -140,20 +147,20 @@
|
||||
- (void)presentOptions {
|
||||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
||||
if (nil == fPopOverController) {
|
||||
UINavigationController* navigation = [[UINavigationController alloc]
|
||||
UINavigationController* navigation = [[UINavigationController alloc]
|
||||
initWithRootViewController:fOptionsController];
|
||||
navigation.navigationBar.topItem.title = @"Options";
|
||||
fPopOverController = [[UIPopoverController alloc] initWithContentViewController:navigation];
|
||||
[navigation release];
|
||||
}
|
||||
|
||||
|
||||
if (fPopOverController.isPopoverVisible)
|
||||
[fPopOverController dismissPopoverAnimated:YES];
|
||||
else
|
||||
[fPopOverController presentPopoverFromBarButtonItem:fOptionsButton
|
||||
permittedArrowDirections:UIPopoverArrowDirectionAny
|
||||
[fPopOverController presentPopoverFromBarButtonItem:fOptionsButton
|
||||
permittedArrowDirections:UIPopoverArrowDirectionAny
|
||||
animated:YES];
|
||||
|
||||
|
||||
} else {
|
||||
UIBarButtonItem* backButton = [[UIBarButtonItem alloc] initWithTitle:@"Back"
|
||||
style:UIBarButtonItemStyleBordered
|
||||
@ -165,7 +172,7 @@
|
||||
self.navigationController.navigationBar.topItem.title = @"Options";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Popover Management
|
||||
- (void)showRootPopoverButtonItem:(UIBarButtonItem *)barButtonItem {
|
||||
[self.navigationItem setLeftBarButtonItem:barButtonItem animated:NO];
|
||||
@ -175,4 +182,5 @@
|
||||
[self.navigationItem setLeftBarButtonItem:nil animated:NO];
|
||||
}
|
||||
|
||||
@end
|
||||
@end
|
||||
|
||||
|
@ -18,9 +18,9 @@ int main(int argc, char *argv[]) {
|
||||
NSString *resourceDir = [docsDir stringByAppendingString:@"/resources"];
|
||||
const char *d = [resourceDir UTF8String];
|
||||
|
||||
// change to the dcouments directory. To allow the 'writePath' flag to use relative paths.
|
||||
// change to the dcouments directory. To allow the 'writePath' flag to use relative paths.
|
||||
NSFileManager *filemgr = [NSFileManager defaultManager];
|
||||
int retVal = 99;
|
||||
int retVal = 99;
|
||||
if ([filemgr changeCurrentDirectoryPath: docsDir] == YES)
|
||||
{
|
||||
IOS_launch_type launchType = set_cmd_line_args(argc, argv, d);
|
||||
|
@ -38,19 +38,19 @@ public:
|
||||
#endif
|
||||
fBackend = SkOSWindow::kNone_BackEndType;
|
||||
}
|
||||
|
||||
|
||||
virtual ~SkiOSDeviceManager() {
|
||||
#if SK_SUPPORT_GPU
|
||||
SkSafeUnref(fCurContext);
|
||||
SkSafeUnref(fCurIntf);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void setUpBackend(SampleWindow* win, int msaaSampleCount, bool deepColor) override {
|
||||
SkASSERT(SkOSWindow::kNone_BackEndType == fBackend);
|
||||
|
||||
|
||||
fBackend = SkOSWindow::kNone_BackEndType;
|
||||
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
switch (win->getDeviceType()) {
|
||||
case SampleWindow::kRaster_DeviceType:
|
||||
@ -73,7 +73,7 @@ public:
|
||||
fDeepColor = deepColor;
|
||||
// Assume that we have at least 24-bit output, for backends that don't supply this data
|
||||
fActualColorBits = SkTMax(info.fColorBits, 24);
|
||||
|
||||
|
||||
SkASSERT(NULL == fCurIntf);
|
||||
switch (win->getDeviceType()) {
|
||||
case SampleWindow::kRaster_DeviceType:
|
||||
@ -86,12 +86,12 @@ public:
|
||||
SkASSERT(false);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
SkASSERT(NULL == fCurContext);
|
||||
if (SkOSWindow::kNone_BackEndType != fBackend) {
|
||||
fCurContext = GrContext::MakeGL(fCurIntf).release();
|
||||
}
|
||||
|
||||
|
||||
if ((NULL == fCurContext || NULL == fCurIntf) &&
|
||||
SkOSWindow::kNone_BackEndType != fBackend) {
|
||||
// We need some context and interface to see results if we're using a GL backend
|
||||
@ -104,15 +104,15 @@ public:
|
||||
// call windowSizeChanged to create the render target
|
||||
this->windowSizeChanged(win);
|
||||
}
|
||||
|
||||
|
||||
void tearDownBackend(SampleWindow *win) override {
|
||||
#if SK_SUPPORT_GPU
|
||||
SkSafeUnref(fCurContext);
|
||||
fCurContext = NULL;
|
||||
|
||||
|
||||
SkSafeUnref(fCurIntf);
|
||||
fCurIntf = NULL;
|
||||
|
||||
|
||||
fGpuSurface = nullptr;
|
||||
#endif
|
||||
win->release();
|
||||
@ -197,9 +197,9 @@ private:
|
||||
bool fDeepColor;
|
||||
int fActualColorBits;
|
||||
#endif
|
||||
|
||||
|
||||
SkOSWindow::SkBackEndTypes fBackend;
|
||||
|
||||
|
||||
typedef SampleWindow::DeviceManager INHERITED;
|
||||
};
|
||||
|
||||
@ -214,7 +214,7 @@ private:
|
||||
|
||||
struct FPSState {
|
||||
static const int FRAME_COUNT = 60;
|
||||
|
||||
|
||||
CFTimeInterval fNow0, fNow1;
|
||||
CFTimeInterval fTime0, fTime1, fTotalTime;
|
||||
int fFrameCounter;
|
||||
@ -223,25 +223,25 @@ struct FPSState {
|
||||
fTime0 = fTime1 = fTotalTime = 0;
|
||||
fFrameCounter = 0;
|
||||
}
|
||||
|
||||
|
||||
void startDraw() {
|
||||
fNow0 = CACurrentMediaTime();
|
||||
}
|
||||
|
||||
|
||||
void endDraw() {
|
||||
fNow1 = CACurrentMediaTime();
|
||||
}
|
||||
|
||||
|
||||
void flush(SkOSWindow* hwnd) {
|
||||
CFTimeInterval now2 = CACurrentMediaTime();
|
||||
|
||||
|
||||
fTime0 += fNow1 - fNow0;
|
||||
fTime1 += now2 - fNow1;
|
||||
|
||||
|
||||
if (++fFrameCounter == FRAME_COUNT) {
|
||||
CFTimeInterval totalNow = CACurrentMediaTime();
|
||||
fTotalTime = totalNow - fTotalTime;
|
||||
|
||||
|
||||
//SkMSec ms0 = (int)(1000 * fTime0 / FRAME_COUNT);
|
||||
//SkMSec msTotal = (int)(1000 * fTotalTime / FRAME_COUNT);
|
||||
//str.printf(" ms: %d [%d], fps: %3.1f", msTotal, ms0,
|
||||
@ -267,32 +267,32 @@ static FPSState gFPS;
|
||||
if (self = [super initWithDefaults]) {
|
||||
fRedrawRequestPending = false;
|
||||
fFPSState = new FPSState;
|
||||
|
||||
|
||||
#ifdef USE_GL_1
|
||||
fGL.fContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES1];
|
||||
#else
|
||||
fGL.fContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
|
||||
#endif
|
||||
|
||||
|
||||
if (!fGL.fContext || ![EAGLContext setCurrentContext:fGL.fContext])
|
||||
{
|
||||
[self release];
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
// Create default framebuffer object. The backing will be allocated for the current layer in -resizeFromLayer
|
||||
glGenFramebuffers(1, &fGL.fFramebuffer);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, fGL.fFramebuffer);
|
||||
|
||||
|
||||
glGenRenderbuffers(1, &fGL.fRenderbuffer);
|
||||
glGenRenderbuffers(1, &fGL.fStencilbuffer);
|
||||
|
||||
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, fGL.fRenderbuffer);
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, fGL.fRenderbuffer);
|
||||
|
||||
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, fGL.fStencilbuffer);
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, fGL.fStencilbuffer);
|
||||
|
||||
|
||||
self.fGLLayer = [CAEAGLLayer layer];
|
||||
fGLLayer.bounds = self.bounds;
|
||||
fGLLayer.anchorPoint = CGPointMake(0, 0);
|
||||
@ -304,12 +304,12 @@ static FPSState gFPS;
|
||||
SKGL_CONFIG,
|
||||
kEAGLDrawablePropertyColorFormat,
|
||||
nil];
|
||||
|
||||
|
||||
self.fRasterLayer = [CALayer layer];
|
||||
fRasterLayer.anchorPoint = CGPointMake(0, 0);
|
||||
fRasterLayer.opaque = TRUE;
|
||||
[self.layer addSublayer:fRasterLayer];
|
||||
|
||||
|
||||
NSMutableDictionary *newActions = [[NSMutableDictionary alloc] initWithObjectsAndKeys:[NSNull null], @"onOrderIn",
|
||||
[NSNull null], @"onOrderOut",
|
||||
[NSNull null], @"sublayers",
|
||||
@ -319,7 +319,7 @@ static FPSState gFPS;
|
||||
fGLLayer.actions = newActions;
|
||||
fRasterLayer.actions = newActions;
|
||||
[newActions release];
|
||||
|
||||
|
||||
// rebuild argc and argv from process info
|
||||
NSArray* arguments = [[NSProcessInfo processInfo] arguments];
|
||||
int argc = [arguments count];
|
||||
@ -330,12 +330,12 @@ static FPSState gFPS;
|
||||
argv[i] = new char[strlen+1];
|
||||
[arg getCString:argv[i] maxLength:strlen+1 encoding:NSUTF8StringEncoding];
|
||||
}
|
||||
|
||||
|
||||
fDevManager = new SkiOSDeviceManager(fGL.fFramebuffer);
|
||||
fWind = new SampleWindow(self, argc, argv, fDevManager);
|
||||
|
||||
fWind->resize(self.frame.size.width, self.frame.size.height);
|
||||
|
||||
|
||||
for (int i = 0; i < argc; ++i) {
|
||||
delete [] argv[i];
|
||||
}
|
||||
@ -355,21 +355,21 @@ static FPSState gFPS;
|
||||
|
||||
- (void)layoutSubviews {
|
||||
int W, H;
|
||||
|
||||
|
||||
// Allocate color buffer backing based on the current layer size
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, fGL.fRenderbuffer);
|
||||
[fGL.fContext renderbufferStorage:GL_RENDERBUFFER fromDrawable:fGLLayer];
|
||||
|
||||
|
||||
glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, &fGL.fWidth);
|
||||
glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_HEIGHT, &fGL.fHeight);
|
||||
|
||||
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, fGL.fStencilbuffer);
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX8, fGL.fWidth, fGL.fHeight);
|
||||
|
||||
|
||||
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
|
||||
NSLog(@"Failed to make complete framebuffer object %x", glCheckFramebufferStatus(GL_FRAMEBUFFER));
|
||||
}
|
||||
|
||||
|
||||
if (fDevManager->isUsingGL()) {
|
||||
W = fGL.fWidth;
|
||||
H = fGL.fHeight;
|
||||
@ -382,7 +382,7 @@ static FPSState gFPS;
|
||||
H = (int)CGRectGetHeight(rect);
|
||||
fRasterLayer.bounds = rect;
|
||||
}
|
||||
|
||||
|
||||
printf("---- layoutSubviews %d %d\n", W, H);
|
||||
fWind->resize(W, H);
|
||||
fWind->inval(NULL);
|
||||
@ -405,11 +405,11 @@ static FPSState gFPS;
|
||||
// This application only creates a single context which is already set current at this point.
|
||||
// This call is redundant, but needed if dealing with multiple contexts.
|
||||
[EAGLContext setCurrentContext:fGL.fContext];
|
||||
|
||||
|
||||
// This application only creates a single default framebuffer which is already bound at this point.
|
||||
// This call is redundant, but needed if dealing with multiple framebuffers.
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, fGL.fFramebuffer);
|
||||
|
||||
|
||||
GLint scissorEnable;
|
||||
glGetIntegerv(GL_SCISSOR_TEST, &scissorEnable);
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
@ -419,8 +419,8 @@ static FPSState gFPS;
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
}
|
||||
glViewport(0, 0, fGL.fWidth, fGL.fHeight);
|
||||
|
||||
|
||||
|
||||
|
||||
sk_sp<SkSurface> surface(fWind->makeSurface());
|
||||
SkCanvas* canvas = surface->getCanvas();
|
||||
|
||||
@ -449,7 +449,7 @@ static FPSState gFPS;
|
||||
- (void)forceRedraw {
|
||||
if (fDevManager->isUsingGL())
|
||||
[self drawInGL];
|
||||
else
|
||||
else
|
||||
[self drawInRaster];
|
||||
}
|
||||
|
||||
@ -459,9 +459,9 @@ static FPSState gFPS;
|
||||
NSString* text = [NSString stringWithUTF8String:title];
|
||||
if ([text length] > 0)
|
||||
self.fTitle = text;
|
||||
|
||||
|
||||
if (fTitleItem && fTitle) {
|
||||
fTitleItem.title = [NSString stringWithFormat:@"%@%@", fTitle,
|
||||
fTitleItem.title = [NSString stringWithFormat:@"%@%@", fTitle,
|
||||
[NSString stringWithUTF8String:fFPSState->str.c_str()]];
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Copyright 2016 Google Inc.
|
||||
#
|
||||
#
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
|
12
gm/cgm.c
12
gm/cgm.c
@ -29,21 +29,21 @@ static sk_shader_t* make_shader() {
|
||||
static void do_draw(sk_canvas_t* canvas) {
|
||||
sk_paint_t* paint = sk_paint_new();
|
||||
sk_paint_set_antialias(paint, true);
|
||||
|
||||
|
||||
sk_paint_set_color(paint, 0xFFFFFFFF);
|
||||
sk_canvas_draw_paint(canvas, paint);
|
||||
|
||||
|
||||
sk_rect_t r = { 10, 10, W - 10, H - 10 };
|
||||
|
||||
|
||||
sk_paint_set_color(paint, 0xFFFF0000);
|
||||
sk_canvas_draw_rect(canvas, &r, paint);
|
||||
|
||||
|
||||
sk_shader_t* shader = make_shader();
|
||||
sk_paint_set_shader(paint, shader);
|
||||
sk_shader_unref(shader);
|
||||
|
||||
|
||||
sk_canvas_draw_oval(canvas, &r, paint);
|
||||
|
||||
|
||||
sk_paint_delete(paint);
|
||||
}
|
||||
|
||||
|
@ -512,7 +512,7 @@ DEF_SIMPLE_GM(longpathdash, canvas, 612, 612) {
|
||||
p.setStrokeWidth(1);
|
||||
const SkScalar intervals[] = { 1, 1 };
|
||||
p.setPathEffect(SkDashPathEffect::Make(intervals, SK_ARRAY_COUNT(intervals), 0));
|
||||
|
||||
|
||||
canvas->translate(50, 50);
|
||||
canvas->drawPath(lines, p);
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ const int RECT_HEIGHT = CELL_HEIGHT - (2 * PAD_HEIGHT);
|
||||
static void shade_rect(SkCanvas* canvas, sk_sp<SkShader> shader, int cellRow, int cellCol) {
|
||||
SkPaint paint;
|
||||
paint.setShader(shader);
|
||||
|
||||
|
||||
SkRect rect = SkRect::MakeXYWH(SkIntToScalar(cellCol * CELL_WIDTH + PAD_WIDTH),
|
||||
SkIntToScalar(cellRow * CELL_HEIGHT + PAD_HEIGHT),
|
||||
SkIntToScalar(RECT_WIDTH),
|
||||
@ -154,7 +154,7 @@ protected:
|
||||
|
||||
shade_rect(canvas, shader, cellRow, cellCol);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -28,7 +28,7 @@ constexpr int kClipOffset = 32;
|
||||
class Object {
|
||||
public:
|
||||
virtual ~Object() {}
|
||||
// When it returns true, this call will have placed a device-space _circle, rect or
|
||||
// When it returns true, this call will have placed a device-space _circle, rect or
|
||||
// simple circular_ RRect in "rr"
|
||||
virtual bool asDevSpaceRRect(const SkMatrix& ctm, SkRRect* rr) const = 0;
|
||||
virtual SkPath asPath(SkScalar inset) const = 0;
|
||||
@ -173,7 +173,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
SkPath asPath(SkScalar inset) const override {
|
||||
SkPath asPath(SkScalar inset) const override {
|
||||
SkRRect tmp = fRRect;
|
||||
tmp.inset(inset, inset);
|
||||
|
||||
@ -221,7 +221,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
SkPath asPath(SkScalar inset) const override {
|
||||
SkPath asPath(SkScalar inset) const override {
|
||||
SkRect tmp = fRect;
|
||||
tmp.inset(inset, inset);
|
||||
|
||||
@ -382,7 +382,7 @@ protected:
|
||||
std::unique_ptr<Object> clipObj((*clipMakes[x])(clipRect));
|
||||
std::unique_ptr<Object> drawObj((*drawMakes[y])(cell));
|
||||
|
||||
// The goal is to replace this clipped draw (which clips the
|
||||
// The goal is to replace this clipped draw (which clips the
|
||||
// shadow) with a draw using the geometric clip
|
||||
if (kBlurMask_Mode == fMode) {
|
||||
SkPath clippedPath;
|
||||
@ -488,8 +488,8 @@ protected:
|
||||
case 'G':
|
||||
fCoverageGeom = (CoverageGeom) ((fCoverageGeom+1) % kCoverageGeomCount);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -13,13 +13,13 @@ DEF_SIMPLE_GM(skbug_5321, canvas, 128, 128) {
|
||||
SkPaint paint;
|
||||
paint.setStyle(SkPaint::kFill_Style);
|
||||
paint.setTextSize(30);
|
||||
|
||||
|
||||
paint.setTextEncoding(SkPaint::kUTF8_TextEncoding);
|
||||
const char text[] = "x\314\200y"; // utf8(u"x\u0300y")
|
||||
SkScalar x = 20, y = 45;
|
||||
size_t byteLength = strlen(text);
|
||||
canvas->drawText(text, byteLength, x, y, paint);
|
||||
|
||||
|
||||
int glyph_count = paint.countText(text, byteLength);
|
||||
SkAutoTMalloc<SkScalar> widths(glyph_count);
|
||||
(void)paint.getTextWidths(text, byteLength, &widths[0]);
|
||||
|
@ -1542,7 +1542,7 @@ public:
|
||||
@param constraint filter strictly within image or draw faster
|
||||
*/
|
||||
void drawImageRect(const sk_sp<SkImage>& image, const SkIRect& isrc, const SkRect& dst,
|
||||
const SkPaint* paint,
|
||||
const SkPaint* paint,
|
||||
SrcRectConstraint constraint = kStrict_SrcRectConstraint) {
|
||||
this->drawImageRect(image.get(), isrc, dst, paint, constraint);
|
||||
}
|
||||
@ -1696,7 +1696,7 @@ public:
|
||||
@param constraint sample strictly within isrc, or draw faster
|
||||
*/
|
||||
void drawBitmapRect(const SkBitmap& bitmap, const SkIRect& isrc, const SkRect& dst,
|
||||
const SkPaint* paint,
|
||||
const SkPaint* paint,
|
||||
SrcRectConstraint constraint = kStrict_SrcRectConstraint);
|
||||
|
||||
/** Draw SkBitmap bitmap, scaled and translated to fill SkRect dst.
|
||||
|
@ -67,7 +67,7 @@ static inline U8CPU SkUnitScalarClampToByte(SkScalar x) {
|
||||
#define SK_RGBA_A32_SHIFT 24
|
||||
#endif
|
||||
|
||||
#define SkGetPackedA32(packed) ((uint32_t)((packed) << (24 - SK_A32_SHIFT)) >> 24)
|
||||
#define SkGetPackedA32(packed) ((uint32_t)((packed) << (24 - SK_A32_SHIFT)) >> 24)
|
||||
#define SkGetPackedR32(packed) ((uint32_t)((packed) << (24 - SK_R32_SHIFT)) >> 24)
|
||||
#define SkGetPackedG32(packed) ((uint32_t)((packed) << (24 - SK_G32_SHIFT)) >> 24)
|
||||
#define SkGetPackedB32(packed) ((uint32_t)((packed) << (24 - SK_B32_SHIFT)) >> 24)
|
||||
|
@ -66,7 +66,7 @@ public:
|
||||
protected:
|
||||
virtual SkRect onGetBounds() = 0;
|
||||
virtual void onDraw(SkCanvas*) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Default implementation calls onDraw() with a canvas that records into a picture. Subclasses
|
||||
* may override if they have a more efficient way to return a picture for the current state
|
||||
|
@ -95,7 +95,7 @@ public:
|
||||
* Apply this cropRect to the imageBounds. If a given edge of the cropRect is not
|
||||
* set, then the corresponding edge from imageBounds will be used. If "embiggen"
|
||||
* is true, the crop rect is allowed to enlarge the size of the rect, otherwise
|
||||
* it may only reduce the rect. Filters that can affect transparent black should
|
||||
* it may only reduce the rect. Filters that can affect transparent black should
|
||||
* pass "true", while all other filters should pass "false".
|
||||
*
|
||||
* Note: imageBounds is in "device" space, as the output cropped rectangle will be,
|
||||
@ -342,7 +342,7 @@ protected:
|
||||
// calls filterImage() on that input, and returns the result.
|
||||
sk_sp<SkSpecialImage> filterInput(int index,
|
||||
SkSpecialImage* src,
|
||||
const Context&,
|
||||
const Context&,
|
||||
SkIPoint* offset) const;
|
||||
|
||||
/**
|
||||
|
@ -117,7 +117,7 @@ static int SkColorTypeShiftPerPixel(SkColorType ct) {
|
||||
};
|
||||
static_assert(SK_ARRAY_COUNT(gShift) == (size_t)(kLastEnum_SkColorType + 1),
|
||||
"size_mismatch_with_SkColorType_enum");
|
||||
|
||||
|
||||
SkASSERT((size_t)ct < SK_ARRAY_COUNT(gShift));
|
||||
return gShift[ct];
|
||||
}
|
||||
@ -225,7 +225,7 @@ public:
|
||||
static SkImageInfo MakeUnknown() {
|
||||
return MakeUnknown(0, 0);
|
||||
}
|
||||
|
||||
|
||||
int width() const { return fWidth; }
|
||||
int height() const { return fHeight; }
|
||||
SkColorType colorType() const { return fColorType; }
|
||||
@ -257,7 +257,7 @@ public:
|
||||
SkImageInfo makeAlphaType(SkAlphaType newAlphaType) const {
|
||||
return Make(fWidth, fHeight, fColorType, newAlphaType, fColorSpace);
|
||||
}
|
||||
|
||||
|
||||
SkImageInfo makeColorType(SkColorType newColorType) const {
|
||||
return Make(fWidth, fHeight, newColorType, fAlphaType, fColorSpace);
|
||||
}
|
||||
|
@ -569,7 +569,7 @@ public:
|
||||
* scale and translate elements. If it contains other elements, the results are undefined.
|
||||
*/
|
||||
void mapRectScaleTranslate(SkRect* dst, const SkRect& src) const;
|
||||
|
||||
|
||||
/** Return the mean radius of a circle after it has been mapped by
|
||||
this matrix. NOTE: in perspective this value assumes the circle
|
||||
has its center at the origin.
|
||||
@ -721,15 +721,15 @@ public:
|
||||
fMat[kMScaleX] = sx;
|
||||
fMat[kMSkewX] = 0;
|
||||
fMat[kMTransX] = tx;
|
||||
|
||||
|
||||
fMat[kMSkewY] = 0;
|
||||
fMat[kMScaleY] = sy;
|
||||
fMat[kMTransY] = ty;
|
||||
|
||||
|
||||
fMat[kMPersp0] = 0;
|
||||
fMat[kMPersp1] = 0;
|
||||
fMat[kMPersp2] = 1;
|
||||
|
||||
|
||||
unsigned mask = 0;
|
||||
if (sx != 1 || sy != 1) {
|
||||
mask |= kScale_Mask;
|
||||
@ -739,7 +739,7 @@ public:
|
||||
}
|
||||
this->setTypeMask(mask | kRectStaysRect_Mask);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Are all elements of the matrix finite?
|
||||
*/
|
||||
|
@ -215,13 +215,13 @@ struct SK_API SkPoint {
|
||||
|
||||
void setRectFan(SkScalar l, SkScalar t, SkScalar r, SkScalar b, size_t stride) {
|
||||
SkASSERT(stride >= sizeof(SkPoint));
|
||||
|
||||
|
||||
((SkPoint*)((intptr_t)this + 0 * stride))->set(l, t);
|
||||
((SkPoint*)((intptr_t)this + 1 * stride))->set(l, b);
|
||||
((SkPoint*)((intptr_t)this + 2 * stride))->set(r, b);
|
||||
((SkPoint*)((intptr_t)this + 3 * stride))->set(r, t);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void Offset(SkPoint points[], int count, const SkPoint& offset) {
|
||||
Offset(points, count, offset.fX, offset.fY);
|
||||
@ -351,13 +351,13 @@ struct SK_API SkPoint {
|
||||
SkPoint operator*(SkScalar scale) const {
|
||||
return Make(fX * scale, fY * scale);
|
||||
}
|
||||
|
||||
|
||||
SkPoint& operator*=(SkScalar scale) {
|
||||
fX *= scale;
|
||||
fY *= scale;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns true if both X and Y are finite (not infinity or NaN)
|
||||
*/
|
||||
|
@ -57,7 +57,7 @@ struct SK_API SkPoint3 {
|
||||
|
||||
/** Scale the point's coordinates by scale.
|
||||
*/
|
||||
void scale(SkScalar value) {
|
||||
void scale(SkScalar value) {
|
||||
fX *= value;
|
||||
fY *= value;
|
||||
fZ *= value;
|
||||
|
@ -45,7 +45,7 @@ struct SkRSXform {
|
||||
bool rectStaysRect() const {
|
||||
return 0 == fSCos || 0 == fSSin;
|
||||
}
|
||||
|
||||
|
||||
void setIdentity() {
|
||||
fSCos = 1;
|
||||
fSSin = fTx = fTy = 0;
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
* block, or false if the iterator is exhausted.
|
||||
*/
|
||||
bool next();
|
||||
|
||||
|
||||
private:
|
||||
const SkBufferBlock* fBlock;
|
||||
size_t fRemaining;
|
||||
@ -101,7 +101,7 @@ public:
|
||||
#else
|
||||
void validate() const {}
|
||||
#endif
|
||||
|
||||
|
||||
private:
|
||||
SkBufferHead* fHead;
|
||||
SkBufferBlock* fTail;
|
||||
|
@ -57,7 +57,7 @@ public:
|
||||
* The caller is responsible for calling unref() on the returned object, if non NULL.
|
||||
*/
|
||||
sk_sp<SkLayerRasterizer> snapshot() const;
|
||||
|
||||
|
||||
private:
|
||||
SkDeque* fLayers;
|
||||
};
|
||||
|
@ -18,7 +18,7 @@ public:
|
||||
* of the intersection of two round rects.
|
||||
* Currently this is only useable with round rects that have the same radii at
|
||||
* all the corners and for which the x & y radii are equal.
|
||||
*
|
||||
*
|
||||
* In order to minimize fill the coverage geometry that should be drawn should be no larger
|
||||
* than the intersection of the bounding boxes of the two round rects. Ambitious users can
|
||||
* omit the center area of the coverage geometry if it is known to be occluded.
|
||||
|
@ -155,7 +155,7 @@ static inline GrColor GrPremulColor(GrColor color) {
|
||||
static inline GrColor GrUnpremulColor(GrColor color) {
|
||||
GrColorIsPMAssert(color);
|
||||
unsigned r = GrColorUnpackR(color);
|
||||
unsigned g = GrColorUnpackG(color);
|
||||
unsigned g = GrColorUnpackG(color);
|
||||
unsigned b = GrColorUnpackB(color);
|
||||
unsigned a = GrColorUnpackA(color);
|
||||
SkPMColor colorPM = SkPackARGB32(a, r, g, b);
|
||||
|
@ -31,8 +31,8 @@ enum GrVkFeatureFlags {
|
||||
|
||||
// The BackendContext contains all of the base Vulkan objects needed by the GrVkGpu. The assumption
|
||||
// is that the client will set these up and pass them to the GrVkGpu constructor. The VkDevice
|
||||
// created must support at least one graphics queue, which is passed in as well.
|
||||
// The QueueFamilyIndex must match the family of the given queue. It is needed for CommandPool
|
||||
// created must support at least one graphics queue, which is passed in as well.
|
||||
// The QueueFamilyIndex must match the family of the given queue. It is needed for CommandPool
|
||||
// creation, and any GrBackendObjects handed to us (e.g., for wrapped textures) need to be created
|
||||
// in or transitioned to that family.
|
||||
struct GrVkBackendContext : public SkRefCnt {
|
||||
|
@ -76,12 +76,12 @@ public:
|
||||
|
||||
@param path The second operand.
|
||||
@param _operator The operator to apply to the existing and supplied paths.
|
||||
*/
|
||||
*/
|
||||
void add(const SkPath& path, SkPathOp _operator);
|
||||
|
||||
/** Computes the sum of all paths and operands, and resets the builder to its
|
||||
initial state.
|
||||
|
||||
|
||||
@param result The product of the operands.
|
||||
@return True if the operation succeeded.
|
||||
*/
|
||||
|
@ -23,13 +23,13 @@ class GrOp;
|
||||
* to json.
|
||||
*
|
||||
* Capturing this information is expensive and consumes a lot of memory, therefore it is important
|
||||
* to enable auditing only when required and disable it promptly. The AutoEnable class helps to
|
||||
* to enable auditing only when required and disable it promptly. The AutoEnable class helps to
|
||||
* ensure that the audit trail is disabled in a timely fashion. Once the information has been dealt
|
||||
* with, be sure to call reset(), or the log will simply keep growing.
|
||||
*/
|
||||
class GrAuditTrail {
|
||||
public:
|
||||
GrAuditTrail()
|
||||
GrAuditTrail()
|
||||
: fClientID(kGrAuditTrailInvalidID)
|
||||
, fEnabled(false) {}
|
||||
|
||||
|
@ -59,7 +59,7 @@ public:
|
||||
*/
|
||||
class Dumper : public SkRefCnt {
|
||||
public:
|
||||
|
||||
|
||||
|
||||
virtual void dump(SkDumpCanvas*, SkDumpCanvas::Verb, const char str[],
|
||||
const SkPaint*) = 0;
|
||||
|
@ -67,7 +67,7 @@ public:
|
||||
virtual ~Visitor() {}
|
||||
virtual void operator()(const char*, size_t, SkScalar x, SkScalar y, const SkPaint&) = 0;
|
||||
};
|
||||
|
||||
|
||||
private:
|
||||
SkRect fBox;
|
||||
SkScalar fSpacingMul, fSpacingAdd;
|
||||
|
@ -21,7 +21,7 @@ struct SkTagList;
|
||||
*/
|
||||
class SkEventSink : public SkRefCnt {
|
||||
public:
|
||||
|
||||
|
||||
|
||||
SkEventSink();
|
||||
virtual ~SkEventSink();
|
||||
|
@ -31,7 +31,7 @@ class ZipUtilsTest(unittest.TestCase):
|
||||
fw.write('b.txt', 0751)
|
||||
fw.write('c.txt', 0640)
|
||||
fw.write(os.path.join('subdir', 'd.txt'), 0640)
|
||||
|
||||
|
||||
# Zip, unzip.
|
||||
zip_utils.zip('input', 'test.zip')
|
||||
zip_utils.unzip('test.zip', 'output')
|
||||
|
@ -147,7 +147,7 @@ protected:
|
||||
{ fTexX + texWidth, fTexY + texHeight},
|
||||
{ fTexX - texWidth, fTexY + texHeight}}
|
||||
;
|
||||
|
||||
|
||||
SkScalar scaleFreq = 2.0;
|
||||
fShader1 = SkPerlinNoiseShader::MakeImprovedNoise(fXFreq/scaleFreq, fYFreq/scaleFreq, 4,
|
||||
fSeed);
|
||||
|
@ -616,11 +616,11 @@ struct UniControl {
|
||||
struct BiControl : public UniControl {
|
||||
SkScalar fValHi;
|
||||
|
||||
BiControl(const char* name, SkScalar min, SkScalar max)
|
||||
BiControl(const char* name, SkScalar min, SkScalar max)
|
||||
: UniControl(name, min, max)
|
||||
, fValHi(fMax) {
|
||||
}
|
||||
|
||||
|
||||
virtual ~BiControl() {}
|
||||
|
||||
virtual void draw(SkCanvas* canvas, const ControlPaints& paints) {
|
||||
@ -683,7 +683,7 @@ public:
|
||||
|
||||
MyClick(SkView* target, ClickType type, ControlType control)
|
||||
: Click(target)
|
||||
, fType(type)
|
||||
, fType(type)
|
||||
, fControl(control)
|
||||
, fVerb((SkPath::Verb) -1)
|
||||
, fWeight(1) {
|
||||
@ -691,7 +691,7 @@ public:
|
||||
|
||||
MyClick(SkView* target, ClickType type, int index)
|
||||
: Click(target)
|
||||
, fType(type)
|
||||
, fType(type)
|
||||
, fControl((ControlType) index)
|
||||
, fVerb((SkPath::Verb) -1)
|
||||
, fWeight(1) {
|
||||
@ -699,7 +699,7 @@ public:
|
||||
|
||||
MyClick(SkView* target, ClickType type, int index, SkPath::Verb verb, SkScalar weight)
|
||||
: Click(target)
|
||||
, fType(type)
|
||||
, fType(type)
|
||||
, fControl((ControlType) index)
|
||||
, fVerb(verb)
|
||||
, fWeight(weight) {
|
||||
@ -819,7 +819,7 @@ class AAGeometryView : public SampleView {
|
||||
|
||||
public:
|
||||
|
||||
AAGeometryView()
|
||||
AAGeometryView()
|
||||
: fResControl("error", 0, 10)
|
||||
, fWeightControl("weight", 0, 5)
|
||||
, fWidthControl("width", FLT_EPSILON, 100)
|
||||
@ -942,7 +942,7 @@ public:
|
||||
SET_CONTROL(Filter);
|
||||
SET_CONTROL(Weight);
|
||||
}
|
||||
|
||||
|
||||
#undef SET_CONTROL
|
||||
|
||||
void set_buttonList(int index, Button* button, MyClick::ControlType type) {
|
||||
@ -973,7 +973,7 @@ public:
|
||||
|
||||
// overrides from SkEventSink
|
||||
bool onQuery(SkEvent* evt) override;
|
||||
|
||||
|
||||
void onSizeChange() override {
|
||||
setControlButtonsPos();
|
||||
this->INHERITED::onSizeChange();
|
||||
@ -1173,7 +1173,7 @@ public:
|
||||
foundFirst = false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (SkPath::kLine_Verb <= verb && verb <= SkPath::kCubic_Verb) {
|
||||
@ -1228,7 +1228,7 @@ public:
|
||||
canvas->drawPath(cPath, complex ? fComplexPaint : fActivePaint);
|
||||
draw_points(canvas, pts, 4);
|
||||
} break;
|
||||
default:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return;
|
||||
@ -1289,7 +1289,7 @@ public:
|
||||
return counter;
|
||||
}
|
||||
} break;
|
||||
default:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1400,7 +1400,7 @@ public:
|
||||
case SkPath::kCubic_Verb:
|
||||
cubic_coverage(pts, distanceMap, w, h);
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1513,7 +1513,7 @@ public:
|
||||
if (!outPath.getBounds().intersects(inPath.getBounds())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1804,9 +1804,9 @@ static struct KeyCommand {
|
||||
const char* fDescriptionR;
|
||||
bool (AAGeometryView::*fFunction)();
|
||||
} kKeyCommandList[] = {
|
||||
{ ' ', 0, "space", "center path", &AAGeometryView::scaleToFit },
|
||||
{ '-', 0, "-", "zoom out", &AAGeometryView::scaleDown },
|
||||
{ '+', '=', "+/=", "zoom in", &AAGeometryView::scaleUp },
|
||||
{ ' ', 0, "space", "center path", &AAGeometryView::scaleToFit },
|
||||
{ '-', 0, "-", "zoom out", &AAGeometryView::scaleDown },
|
||||
{ '+', '=', "+/=", "zoom in", &AAGeometryView::scaleUp },
|
||||
{ 'd', 0, "d", "dump to console", &AAGeometryView::pathDump },
|
||||
{ 'h', 0, "h", "hide controls", &AAGeometryView::hideAll },
|
||||
{ 'r', 0, "r", "reset path", &AAGeometryView::constructPath },
|
||||
@ -1869,5 +1869,5 @@ bool AAGeometryView::onQuery(SkEvent* evt) {
|
||||
}
|
||||
return this->INHERITED::onQuery(evt);
|
||||
}
|
||||
|
||||
|
||||
DEF_SAMPLE( return new AAGeometryView; )
|
||||
|
@ -93,7 +93,7 @@ public:
|
||||
|
||||
void drawRect(const SkRect& r, SkColor c) override {
|
||||
CGContextRef cg = (CGContextRef)fCanvas->accessTopRasterHandle();
|
||||
|
||||
|
||||
CGColorRef color = CGColorCreateGenericRGB(SkColorGetR(c)/255.f,
|
||||
SkColorGetG(c)/255.f,
|
||||
SkColorGetB(c)/255.f,
|
||||
@ -121,7 +121,7 @@ static CGAffineTransform matrix_to_transform(CGContextRef cg, const SkMatrix& ct
|
||||
class Allocator_CG : public SkRasterHandleAllocator {
|
||||
public:
|
||||
Allocator_CG() {}
|
||||
|
||||
|
||||
bool allocHandle(const SkImageInfo& info, Rec* rec) override {
|
||||
// let CG allocate the pixels
|
||||
CGContextRef cg = SkCreateCGContext(SkPixmap(info, nullptr, 0));
|
||||
@ -139,7 +139,7 @@ public:
|
||||
|
||||
void updateHandle(Handle hndl, const SkMatrix& ctm, const SkIRect& clip) override {
|
||||
CGContextRef cg = (CGContextRef)hndl;
|
||||
|
||||
|
||||
CGContextRestoreGState(cg);
|
||||
CGContextSaveGState(cg);
|
||||
CGContextClipToRect(cg, CGRectMake(clip.x(), clip.y(), clip.width(), clip.height()));
|
||||
@ -282,7 +282,7 @@ protected:
|
||||
port->drawRect({0, 0, 30, 30}, SK_ColorBLUE);
|
||||
port->drawOval({10, 10, 20, 20}, SK_ColorWHITE);
|
||||
port->restore();
|
||||
|
||||
|
||||
port->saveLayer({50, 50, 100, 100}, 0x80);
|
||||
port->drawRect({55, 55, 95, 95}, SK_ColorGREEN);
|
||||
port->restore();
|
||||
|
@ -29,13 +29,13 @@ public:
|
||||
|
||||
protected:
|
||||
static constexpr auto kAnimationIterations = 5;
|
||||
|
||||
|
||||
enum State {
|
||||
kZoomIn,
|
||||
kScroll,
|
||||
kZoomOut
|
||||
};
|
||||
|
||||
|
||||
void onOnceBeforeDraw() override {
|
||||
fPath = GetResourcePath("Cowboy.svg");
|
||||
SkFILEStream svgStream(fPath.c_str());
|
||||
@ -79,7 +79,7 @@ protected:
|
||||
canvas->concat(SkMatrix::MakeScale(fDelta));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
fDom->render(canvas);
|
||||
}
|
||||
}
|
||||
@ -100,12 +100,12 @@ protected:
|
||||
|
||||
return this->INHERITED::onQuery(evt);
|
||||
}
|
||||
|
||||
|
||||
bool onAnimate(const SkAnimTimer& timer) override {
|
||||
if (!fDom) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
--fAnimationLoop;
|
||||
if (fAnimationLoop == 0) {
|
||||
fAnimationLoop = kAnimationIterations;
|
||||
@ -126,7 +126,7 @@ protected:
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
sk_sp<SkSVGDOM> fDom;
|
||||
SkString fPath;
|
||||
|
@ -334,7 +334,7 @@ public:
|
||||
N = 4
|
||||
};
|
||||
SkPoint fPts[N];
|
||||
|
||||
|
||||
FatStroke() : fClosed(false), fShowStroke(true), fShowHidden(false), fShowSkeleton(true),
|
||||
fJoinType(0), fCapType(0)
|
||||
{
|
||||
@ -343,35 +343,35 @@ public:
|
||||
fPts[i].fX = 20 + rand.nextUScalar1() * 640;
|
||||
fPts[i].fY = 20 + rand.nextUScalar1() * 480;
|
||||
}
|
||||
|
||||
|
||||
fPtsPaint.setAntiAlias(true);
|
||||
fPtsPaint.setStrokeWidth(10);
|
||||
fPtsPaint.setStrokeCap(SkPaint::kRound_Cap);
|
||||
|
||||
|
||||
fHiddenPaint.setAntiAlias(true);
|
||||
fHiddenPaint.setStyle(SkPaint::kStroke_Style);
|
||||
fHiddenPaint.setColor(0xFF0000FF);
|
||||
|
||||
|
||||
fStrokePaint.setAntiAlias(true);
|
||||
fStrokePaint.setStyle(SkPaint::kStroke_Style);
|
||||
fStrokePaint.setStrokeWidth(50);
|
||||
fStrokePaint.setColor(0x8000FF00);
|
||||
|
||||
|
||||
fSkeletonPaint.setAntiAlias(true);
|
||||
fSkeletonPaint.setStyle(SkPaint::kStroke_Style);
|
||||
fSkeletonPaint.setColor(SK_ColorRED);
|
||||
}
|
||||
|
||||
|
||||
void toggle(bool& value) {
|
||||
value = !value;
|
||||
this->inval(nullptr);
|
||||
}
|
||||
|
||||
|
||||
void toggle3(int& value) {
|
||||
value = (value + 1) % 3;
|
||||
this->inval(nullptr);
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
// overrides from SkEventSink
|
||||
bool onQuery(SkEvent* evt) override {
|
||||
@ -395,7 +395,7 @@ protected:
|
||||
}
|
||||
return this->INHERITED::onQuery(evt);
|
||||
}
|
||||
|
||||
|
||||
void makePath(SkPath* path) {
|
||||
path->moveTo(fPts[0]);
|
||||
for (int i = 1; i < N; ++i) {
|
||||
@ -405,7 +405,7 @@ protected:
|
||||
path->close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void onDrawContent(SkCanvas* canvas) override {
|
||||
canvas->drawColor(0xFFEEEEEE);
|
||||
|
||||
@ -429,7 +429,7 @@ protected:
|
||||
}
|
||||
canvas->drawPoints(SkCanvas::kPoints_PointMode, N, fPts, fPtsPaint);
|
||||
}
|
||||
|
||||
|
||||
bool onClick(Click* click) override {
|
||||
int32_t index;
|
||||
if (click->fMeta.findS32("index", &index)) {
|
||||
@ -440,7 +440,7 @@ protected:
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) override {
|
||||
const SkScalar tol = 4;
|
||||
const SkRect r = SkRect::MakeXYWH(x - tol, y - tol, tol * 2, tol * 2);
|
||||
@ -453,7 +453,7 @@ protected:
|
||||
}
|
||||
return this->INHERITED::onFindClickHandler(x, y, modi);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
typedef SampleView INHERITED;
|
||||
};
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
~PictFileView() override {
|
||||
this->freePictures();
|
||||
}
|
||||
|
||||
|
||||
void freePictures() {
|
||||
for (int i = 0; i < kBBoxTypeCount; ++i) {
|
||||
SkSafeUnref(fPictures[i]);
|
||||
|
@ -184,7 +184,7 @@ class SkRawStream {
|
||||
public:
|
||||
virtual ~SkRawStream() {}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Gets the length of the stream. Depending on the type of stream, this may require reading to
|
||||
* the end of the stream.
|
||||
*/
|
||||
|
@ -193,7 +193,7 @@ public:
|
||||
SkASSERT(rec->fMalloc != nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool install(SkBitmap* bitmap) {
|
||||
SkAutoMutexAcquire ama(fMutex);
|
||||
|
||||
|
@ -35,7 +35,7 @@ bool SkRBuffer::skipToAlign4() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void* SkWBuffer::skip(size_t size) {
|
||||
|
@ -1440,7 +1440,7 @@ void SkCanvas::onClipRRect(const SkRRect& rrect, SkClipOp op, ClipEdgeStyle edge
|
||||
AutoValidateClip avc(this);
|
||||
|
||||
bool isAA = kSoft_ClipEdgeStyle == edgeStyle;
|
||||
|
||||
|
||||
FOR_EACH_TOP_DEVICE(device->clipRRect(rrect, op, isAA));
|
||||
|
||||
fMCRec->fRasterClip.op(rrect, fMCRec->fMatrix, this->getTopLayerBounds(), (SkRegion::Op)op,
|
||||
@ -1477,7 +1477,7 @@ void SkCanvas::onClipPath(const SkPath& path, SkClipOp op, ClipEdgeStyle edgeSty
|
||||
AutoValidateClip avc(this);
|
||||
|
||||
bool isAA = kSoft_ClipEdgeStyle == edgeStyle;
|
||||
|
||||
|
||||
FOR_EACH_TOP_DEVICE(device->clipPath(path, op, isAA));
|
||||
|
||||
const SkPath* rasterClipPath = &path;
|
||||
|
@ -652,7 +652,7 @@ static bool load_color_lut(sk_sp<SkColorLookUpTable>* colorLUT, uint32_t inputCh
|
||||
* 3x3 matrix with no translation
|
||||
*
|
||||
* @param matrix The matrix to store the result in
|
||||
* @param src Data to load the matrix out of.
|
||||
* @param src Data to load the matrix out of.
|
||||
* @param len The length of |src|.
|
||||
* Must have 48 bytes if |translate| is set and 36 bytes otherwise.
|
||||
* @param translate Whether to read the translation column or not
|
||||
@ -679,7 +679,7 @@ static bool load_matrix(SkMatrix44* matrix, const uint8_t* src, size_t len, bool
|
||||
default:
|
||||
encodingFactor = 1.f;
|
||||
SkASSERT(false);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
float array[16];
|
||||
array[ 0] = encodingFactor * SkFixedToFloat(read_big_endian_i32(src));
|
||||
@ -1100,7 +1100,7 @@ bool load_a2b0_lutn_type(std::vector<SkColorSpace_A2B::Element>* elements, const
|
||||
inTableEntries = read_big_endian_u16(src + 48);
|
||||
outTableEntries = read_big_endian_u16(src + 50);
|
||||
precision = 2;
|
||||
|
||||
|
||||
constexpr size_t kMaxLut16GammaEntries = 4096;
|
||||
if (inTableEntries < 2) {
|
||||
SkColorSpacePrintf("Too few (%d) input gamma table entries. Must have at least 2.\n",
|
||||
@ -1111,7 +1111,7 @@ bool load_a2b0_lutn_type(std::vector<SkColorSpace_A2B::Element>* elements, const
|
||||
inTableEntries, kMaxLut16GammaEntries);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (outTableEntries < 2) {
|
||||
SkColorSpacePrintf("Too few (%d) output gamma table entries. Must have at least 2.\n",
|
||||
outTableEntries);
|
||||
|
@ -1185,7 +1185,7 @@ int SkConic::computeQuadPOW2(SkScalar tol) const {
|
||||
return pow2;
|
||||
}
|
||||
|
||||
// This was originally developed and tested for pathops: see SkOpTypes.h
|
||||
// This was originally developed and tested for pathops: see SkOpTypes.h
|
||||
// returns true if (a <= b <= c) || (a >= b >= c)
|
||||
static bool between(SkScalar a, SkScalar b, SkScalar c) {
|
||||
return (a - b) * (c - b) <= 0;
|
||||
@ -1425,7 +1425,7 @@ int SkConic::BuildUnitArc(const SkVector& uStart, const SkVector& uStop, SkRotat
|
||||
if (!lastQ.equalsWithinTolerance(offCurve)) {
|
||||
dst[conicCount].set(lastQ, offCurve, finalP, cosThetaOver2);
|
||||
conicCount += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// now handle counter-clockwise and the initial unitStart rotation
|
||||
|
@ -27,7 +27,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
// Insert other special-cases here (e.g. scale+translate)
|
||||
|
||||
|
||||
// general case
|
||||
SkMatrix inverse;
|
||||
if (mx.invert(&inverse)) {
|
||||
@ -42,7 +42,7 @@ public:
|
||||
SkASSERT(0 == stride % sizeof(SkScalar));
|
||||
|
||||
SkMatrix::TypeMask tm = mx.getType();
|
||||
|
||||
|
||||
if (SkMatrix::kIdentity_Mask == tm) {
|
||||
return;
|
||||
}
|
||||
@ -57,7 +57,7 @@ public:
|
||||
return;
|
||||
}
|
||||
// Insert other special-cases here (e.g. scale+translate)
|
||||
|
||||
|
||||
// general case
|
||||
SkMatrix::MapXYProc proc = mx.getMapXYProc();
|
||||
for (int i = 0; i < count; ++i) {
|
||||
|
@ -62,7 +62,7 @@ public:
|
||||
static void MakeTextMatrix(SkMatrix* matrix, const SkPaint& paint) {
|
||||
MakeTextMatrix(matrix, paint.getTextSize(), paint.getTextScaleX(), paint.getTextSkewX());
|
||||
}
|
||||
|
||||
|
||||
static bool ShouldDither(const SkPaint&, SkColorType);
|
||||
};
|
||||
|
||||
|
@ -104,7 +104,7 @@ public:
|
||||
}
|
||||
return fPE0->filterPath(dst, *ptr, rec, cullRect);
|
||||
}
|
||||
|
||||
|
||||
|
||||
SK_TO_STRING_OVERRIDE()
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposePathEffect)
|
||||
@ -170,7 +170,7 @@ public:
|
||||
return fPE0->filterPath(dst, src, rec, cullRect) |
|
||||
fPE1->filterPath(dst, src, rec, cullRect);
|
||||
}
|
||||
|
||||
|
||||
|
||||
SK_TO_STRING_OVERRIDE()
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkSumPathEffect)
|
||||
|
@ -95,7 +95,7 @@ SkPictureData::SkPictureData(const SkPictureRecord& record,
|
||||
fVerticesRefs[i] = SkRef(verts[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const SkTDArray<const SkImage*>& imgs = record.getImageRefs();
|
||||
fImageCount = imgs.count();
|
||||
if (fImageCount > 0) {
|
||||
|
@ -223,7 +223,7 @@ public:
|
||||
void setInflator(SkInflator* inf) { fInflator = inf; }
|
||||
|
||||
// sk_sp<SkImage> inflateImage();
|
||||
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Allows subclass to check if we are using factories for expansion
|
||||
|
@ -200,7 +200,7 @@ char* SkRegion::toString() {
|
||||
iter.reset(*this);
|
||||
while (!iter.done()) {
|
||||
const SkIRect& r = iter.rect();
|
||||
count += snprintf(result+count, max - count,
|
||||
count += snprintf(result+count, max - count,
|
||||
"(%d,%d,%d,%d)", r.fLeft, r.fTop, r.fRight, r.fBottom);
|
||||
iter.next();
|
||||
}
|
||||
|
@ -1396,7 +1396,7 @@ void SkStroke::strokePath(const SkPath& src, SkPath* dst) const {
|
||||
|
||||
// We can always ignore centers for stroke and fill convex line-only paths
|
||||
// TODO: remove the line-only restriction
|
||||
bool ignoreCenter = fDoFill && (src.getSegmentMasks() == SkPath::kLine_SegmentMask) &&
|
||||
bool ignoreCenter = fDoFill && (src.getSegmentMasks() == SkPath::kLine_SegmentMask) &&
|
||||
src.isLastContourClosed() && src.isConvex();
|
||||
|
||||
SkPathStroker stroker(src, radius, fMiterLimit, this->getCap(), this->getJoin(),
|
||||
|
@ -247,7 +247,7 @@ private:
|
||||
SkTextBlob::GlyphPositioning positioning) {
|
||||
return glyphCount * ScalarsPerGlyph(positioning);
|
||||
}
|
||||
|
||||
|
||||
uint32_t* textSizePtr() const {
|
||||
// textSize follows the position buffer.
|
||||
SkASSERT(isExtended());
|
||||
@ -809,7 +809,7 @@ sk_sp<SkTextBlob> SkTextBlob::MakeFromBuffer(SkReadBuffer& reader) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return blobBuilder.make();
|
||||
}
|
||||
|
||||
|
@ -216,6 +216,6 @@ sk_sp<SkVertices> SkVertices::Decode(const void* data, size_t length) {
|
||||
reader.read(builder.texCoords(), sizes.fTSize);
|
||||
reader.read(builder.colors(), sizes.fCSize);
|
||||
reader.read(builder.indices(), sizes.fISize);
|
||||
|
||||
|
||||
return builder.detach();
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ sk_sp<SkImageFilter> SkDropShadowImageFilter::Make(SkScalar dx, SkScalar dy,
|
||||
SkColor color, ShadowMode shadowMode,
|
||||
sk_sp<SkImageFilter> input,
|
||||
const CropRect* cropRect) {
|
||||
return sk_sp<SkImageFilter>(new SkDropShadowImageFilter(dx, dy, sigmaX, sigmaY,
|
||||
return sk_sp<SkImageFilter>(new SkDropShadowImageFilter(dx, dy, sigmaX, sigmaY,
|
||||
color, shadowMode,
|
||||
std::move(input),
|
||||
cropRect));
|
||||
|
@ -24,7 +24,7 @@ public:
|
||||
};
|
||||
|
||||
static sk_sp<SkMaskFilter> Make(SkScalar blurSigma, const Light& light);
|
||||
|
||||
|
||||
// overrides from SkMaskFilter
|
||||
// This method is not exported to java.
|
||||
SkMask::Format getFormat() const override;
|
||||
|
@ -22,7 +22,7 @@ sk_sp<SkImageFilter> SkPictureImageFilter::Make(sk_sp<SkPicture> picture) {
|
||||
|
||||
sk_sp<SkImageFilter> SkPictureImageFilter::Make(sk_sp<SkPicture> picture,
|
||||
const SkRect& cropRect) {
|
||||
return sk_sp<SkImageFilter>(new SkPictureImageFilter(std::move(picture),
|
||||
return sk_sp<SkImageFilter>(new SkPictureImageFilter(std::move(picture),
|
||||
cropRect,
|
||||
kDeviceSpace_PictureResolution,
|
||||
kLow_SkFilterQuality,
|
||||
@ -177,7 +177,7 @@ void SkPictureImageFilter::drawPictureAtLocalResolution(SkSpecialImage* source,
|
||||
SkIRect localIBounds = localBounds.roundOut();
|
||||
|
||||
sk_sp<SkSpecialImage> localImg;
|
||||
{
|
||||
{
|
||||
sk_sp<SkSpecialSurface> localSurface(source->makeSurface(ctx.outputProperties(),
|
||||
localIBounds.size()));
|
||||
if (!localSurface) {
|
||||
|
@ -415,7 +415,7 @@ private:
|
||||
second.getBounds().centerX(),
|
||||
second.getBounds().centerY());
|
||||
|
||||
pdman.set4f(fSizesUni,
|
||||
pdman.set4f(fSizesUni,
|
||||
0.5f * first.rect().width(),
|
||||
0.5f * first.rect().height(),
|
||||
0.5f * second.rect().width(),
|
||||
@ -425,7 +425,7 @@ private:
|
||||
edgeFP.secondMode() == kSimpleCircular_Mode) {
|
||||
// This is a bit of overkill since fX should equal fY for both round rects but it
|
||||
// makes the shader code simpler.
|
||||
pdman.set4f(fRadiiUni,
|
||||
pdman.set4f(fRadiiUni,
|
||||
first.getSimpleRadii().fX, first.getSimpleRadii().fY,
|
||||
second.getSimpleRadii().fX, second.getSimpleRadii().fY);
|
||||
}
|
||||
@ -495,7 +495,7 @@ private:
|
||||
bool onIsEqual(const GrFragmentProcessor& proc) const override {
|
||||
const RRectsGaussianEdgeFP& edgeFP = proc.cast<RRectsGaussianEdgeFP>();
|
||||
return fFirst == edgeFP.fFirst &&
|
||||
fSecond == edgeFP.fSecond &&
|
||||
fSecond == edgeFP.fSecond &&
|
||||
fRadius == edgeFP.fRadius;
|
||||
}
|
||||
|
||||
@ -568,9 +568,9 @@ void SkRRectsGaussianEdgeMaskFilterImpl::flatten(SkWriteBuffer& buf) const {
|
||||
sk_sp<SkMaskFilter> SkRRectsGaussianEdgeMaskFilter::Make(const SkRRect& first,
|
||||
const SkRRect& second,
|
||||
SkScalar radius) {
|
||||
if ((!first.isRect() && !first.isCircle() && !first.isSimpleCircular()) ||
|
||||
if ((!first.isRect() && !first.isCircle() && !first.isSimpleCircular()) ||
|
||||
(!second.isRect() && !second.isCircle() && !second.isSimpleCircular())) {
|
||||
// we only deal with the shapes where the x & y radii are equal
|
||||
// we only deal with the shapes where the x & y radii are equal
|
||||
// and the same for all four corners
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ sk_sp<SkSpecialImage> SkTileImageFilter::onFilterImage(SkSpecialImage* source,
|
||||
SkPaint paint;
|
||||
paint.setBlendMode(SkBlendMode::kSrc);
|
||||
|
||||
input->draw(canvas,
|
||||
input->draw(canvas,
|
||||
SkIntToScalar(inputOffset.x()), SkIntToScalar(inputOffset.y()),
|
||||
&paint);
|
||||
|
||||
|
@ -128,7 +128,7 @@ sk_sp<SkSpecialImage> SkXfermodeImageFilter_Base::onFilterImage(SkSpecialImage*
|
||||
srcBounds = SkIRect::MakeXYWH(backgroundOffset.x(), backgroundOffset.y(),
|
||||
background->width(), background->height());
|
||||
}
|
||||
|
||||
|
||||
srcBounds.join(foregroundBounds);
|
||||
if (srcBounds.isEmpty()) {
|
||||
return nullptr;
|
||||
@ -145,7 +145,7 @@ sk_sp<SkSpecialImage> SkXfermodeImageFilter_Base::onFilterImage(SkSpecialImage*
|
||||
#if SK_SUPPORT_GPU
|
||||
if (source->isTextureBacked()) {
|
||||
return this->filterImageGPU(source,
|
||||
background, backgroundOffset,
|
||||
background, backgroundOffset,
|
||||
foreground, foregroundOffset,
|
||||
bounds, ctx.outputProperties());
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
};
|
||||
|
||||
/**
|
||||
* Values for array count that have special meaning. We allow 1-sized arrays.git
|
||||
* Values for array count that have special meaning. We allow 1-sized arrays.git
|
||||
*/
|
||||
enum {
|
||||
kNonArray = 0, // not an array
|
||||
|
@ -18,7 +18,7 @@ public:
|
||||
GrContext* getContext() { return fSurfaceContext->fContext; }
|
||||
|
||||
private:
|
||||
explicit GrSurfaceContextPriv(GrSurfaceContext* surfaceContext)
|
||||
explicit GrSurfaceContextPriv(GrSurfaceContext* surfaceContext)
|
||||
: fSurfaceContext(surfaceContext) {
|
||||
}
|
||||
|
||||
|
@ -454,7 +454,7 @@ void GrSurfaceProxyPriv::exactify() {
|
||||
if (fProxy->fTarget) {
|
||||
// The kApprox but already instantiated case. Setting the proxy's width & height to
|
||||
// the instantiated width & height could have side-effects going forward, since we're
|
||||
// obliterating the area of interest information. This call (exactify) only used
|
||||
// obliterating the area of interest information. This call (exactify) only used
|
||||
// when converting an SkSpecialImage to an SkImage so the proxy shouldn't be
|
||||
// used for additional draws.
|
||||
fProxy->fWidth = fProxy->fTarget->width();
|
||||
|
@ -46,7 +46,7 @@ struct WindingVertex {
|
||||
int PathToVertices(const SkPath& path, SkScalar tolerance, const SkRect& clipBounds,
|
||||
WindingVertex** verts);
|
||||
|
||||
int PathToTriangles(const SkPath& path, SkScalar tolerance, const SkRect& clipBounds,
|
||||
int PathToTriangles(const SkPath& path, SkScalar tolerance, const SkRect& clipBounds,
|
||||
VertexAllocator*, bool antialias, const GrColor& color,
|
||||
bool canTweakAlphaForCoverage, bool *isLinear);
|
||||
}
|
||||
|
@ -585,7 +585,7 @@ void GrGLCaps::init(const GrContextOptions& contextOptions,
|
||||
|
||||
// See crbug.com/755871. This could probably be narrowed to just partial clears as the driver
|
||||
// bugs seems to involve clearing too much and not skipping the clear.
|
||||
// See crbug.com/768134. This is also needed for full clears and was seen on an nVidia K620
|
||||
// See crbug.com/768134. This is also needed for full clears and was seen on an nVidia K620
|
||||
// but only for D3D11 ANGLE.
|
||||
if (GrGLANGLEBackend::kD3D11 == ctxInfo.angleBackend()) {
|
||||
fUseDrawInsteadOfClear = true;
|
||||
|
@ -95,7 +95,7 @@ public:
|
||||
~GrGLContext() override;
|
||||
|
||||
private:
|
||||
GrGLContext(const ConstructorArgs& args)
|
||||
GrGLContext(const ConstructorArgs& args)
|
||||
: INHERITED(args)
|
||||
, fCompiler(nullptr) {}
|
||||
|
||||
|
@ -3304,7 +3304,7 @@ static inline bool can_blit_framebuffer_for_copy_surface(
|
||||
if (dstRT && dstRT->numColorSamples() > 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (GrGLCaps::kNoFormatConversion_BlitFramebufferFlag & blitFramebufferFlags) {
|
||||
if (dst->config() != src->config()) {
|
||||
return false;
|
||||
|
@ -226,7 +226,7 @@ void GrGLSLFragmentShaderBuilder::enableCustomOutput() {
|
||||
fCustomColorOutputIndex = fOutputs.count();
|
||||
fOutputs.push_back().set(kHalf4_GrSLType, DeclaredColorOutputName(),
|
||||
GrShaderVar::kOut_TypeModifier);
|
||||
fProgramBuilder->finalizeFragmentOutputColor(fOutputs.back());
|
||||
fProgramBuilder->finalizeFragmentOutputColor(fOutputs.back());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ class InstanceProcessor;
|
||||
* There is only one OpAllocator which encapsulates the creation of InstancedOps and the pool
|
||||
* of memory used for their Draw objects.
|
||||
*
|
||||
* The InstancedRendering class tracks a list of InstancedOps that will all be drawn during
|
||||
* The InstancedRendering class tracks a list of InstancedOps that will all be drawn during
|
||||
* the same flush. There is currently one per opList. The nature of instanced
|
||||
* rendering allows these ops to combine well and render efficiently.
|
||||
* During a flush, it assembles the accumulated draw data into a single vertex and texel
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
|
||||
private:
|
||||
void initFeatureSet(MTLFeatureSet featureSet);
|
||||
|
||||
|
||||
void initGrCaps(const id<MTLDevice> device);
|
||||
void initShaderCaps();
|
||||
void initSampleCount();
|
||||
|
@ -584,7 +584,7 @@ void GrAAConvexTessellator::createOuterRing(const Ring& previousRing, SkScalar o
|
||||
// For very shallow angles all the corner points could fuse
|
||||
if (!duplicate_pt(miter, this->point(perp1Idx))) {
|
||||
int miterIdx;
|
||||
miterIdx = this->addPt(miter, -outset, coverage, false,
|
||||
miterIdx = this->addPt(miter, -outset, coverage, false,
|
||||
kSharp_CurveState);
|
||||
nextRing->addIdx(miterIdx, originalIdx);
|
||||
// The two triangles for the corner
|
||||
|
@ -143,7 +143,7 @@ private:
|
||||
void makeOriginalRing() {
|
||||
for (int i = 0; i < fPts.count(); ++i) {
|
||||
fPts[i].fOrigEdgeId = fPts[i].fIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// init should be called after all the indices have been added (via addIdx)
|
||||
|
@ -172,7 +172,7 @@ private:
|
||||
bool onCombineIfPossible(GrOp* t, const GrCaps& caps) override;
|
||||
|
||||
static constexpr auto kMaxTextures = 4;
|
||||
|
||||
|
||||
// TODO just use class params
|
||||
sk_sp<GrGeometryProcessor> setupDfProcessor(const SkMatrix& viewMatrix, SkColor luminanceColor,
|
||||
GrColor color,
|
||||
|
@ -33,7 +33,7 @@ public:
|
||||
|
||||
#ifdef SK_TRACE_VK_RESOURCES
|
||||
void dumpInfo() const override {
|
||||
SkDebugf("GrVkDescriptorPool: %d, type %d (%d refs)\n", fDescPool, fType,
|
||||
SkDebugf("GrVkDescriptorPool: %d, type %d (%d refs)\n", fDescPool, fType,
|
||||
this->getRefCnt());
|
||||
}
|
||||
#endif
|
||||
|
@ -483,7 +483,7 @@ GrVkSubHeap::GrVkSubHeap(const GrVkGpu* gpu, uint32_t memoryTypeIndex, uint32_t
|
||||
&fAlloc));
|
||||
if (VK_SUCCESS != err) {
|
||||
this->reset();
|
||||
}
|
||||
}
|
||||
#ifdef SK_DEBUG
|
||||
else {
|
||||
gHeapUsage[heapIndex] += size;
|
||||
|
@ -107,7 +107,7 @@ private:
|
||||
const GrVkGpu* fGpu;
|
||||
#ifdef SK_DEBUG
|
||||
uint32_t fHeapIndex;
|
||||
#endif
|
||||
#endif
|
||||
uint32_t fMemoryTypeIndex;
|
||||
VkDeviceMemory fAlloc;
|
||||
|
||||
|
@ -521,7 +521,7 @@ bool AddIntersectTs(SkOpContour* test, SkOpContour* next, SkOpCoincidence* coinc
|
||||
SkOpPtT* nextTAt = iPtIsIntegral ? wn.segment()->addT(ts[!swap][pt], iPt)
|
||||
: wn.segment()->addT(ts[!swap][pt]);
|
||||
if (!testTAt->contains(nextTAt)) {
|
||||
SkOpPtT* oppPrev = testTAt->oppPrev(nextTAt); // Returns nullptr if pair
|
||||
SkOpPtT* oppPrev = testTAt->oppPrev(nextTAt); // Returns nullptr if pair
|
||||
if (oppPrev) { // already share a pt-t loop.
|
||||
testTAt->span()->mergeMatches(nextTAt->span());
|
||||
testTAt->addOpp(nextTAt, oppPrev);
|
||||
|
@ -122,10 +122,10 @@ int SkIntersections::intersect(const SkDLine& a, const SkDLine& b) {
|
||||
computePoints(a, 1);
|
||||
}
|
||||
}
|
||||
/* Allow tracking that both sets of end points are near each other -- the lines are entirely
|
||||
/* Allow tracking that both sets of end points are near each other -- the lines are entirely
|
||||
coincident -- even when the end points are not exactly the same.
|
||||
Mark this as a 'wild card' for the end points, so that either point is considered totally
|
||||
coincident. Then, avoid folding the lines over each other, but allow either end to mate
|
||||
coincident. Then, avoid folding the lines over each other, but allow either end to mate
|
||||
to the next set of lines.
|
||||
*/
|
||||
if (fAllowNear || !unparallel) {
|
||||
|
@ -97,7 +97,7 @@ int SkDCubic::convexHull(char order[4]) const {
|
||||
order[2] = 1;
|
||||
return 3;
|
||||
}
|
||||
// one of the control points may be very nearly but not exactly equal --
|
||||
// one of the control points may be very nearly but not exactly equal --
|
||||
double dist1_0 = fPts[1].distanceSquared(fPts[0]);
|
||||
double dist1_3 = fPts[1].distanceSquared(fPts[3]);
|
||||
double dist2_0 = fPts[2].distanceSquared(fPts[0]);
|
||||
|
@ -327,7 +327,7 @@ void SkOpSpanBase::mergeMatches(SkOpSpanBase* opp) {
|
||||
}
|
||||
SkOpSpanBase* innerBase = inner->span();
|
||||
SkASSERT(innerBase->ptT() == inner);
|
||||
// when the intersection is first detected, the span base is marked if there are
|
||||
// when the intersection is first detected, the span base is marked if there are
|
||||
// more than one point in the intersection.
|
||||
if (!zero_or_one(inner->fT)) {
|
||||
innerBase->upCast()->release(test);
|
||||
|
@ -326,7 +326,7 @@ bool HandleCoincidence(SkOpContourHead* contourList, SkOpCoincidence* coincidenc
|
||||
// adjust the winding value to account for coincident edges
|
||||
if (!pairs->apply(DEBUG_ITER_ONLY_PARAMS(SAFETY_COUNT - safetyHatch))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// For each coincident pair that overlaps another, when the receivers (the 1st of the pair)
|
||||
// are different, construct a new pair to resolve their mutual span
|
||||
if (!pairs->findOverlaps(&overlaps DEBUG_ITER_PARAMS(SAFETY_COUNT - safetyHatch))) {
|
||||
|
@ -1122,7 +1122,7 @@ void SkOpSegment::debugSetCoinT(int index, SkScalar t) const {
|
||||
fDebugBaseMin = SkTMin(t, fDebugBaseMin);
|
||||
fDebugBaseMax = SkTMax(t, fDebugBaseMax);
|
||||
return;
|
||||
}
|
||||
}
|
||||
SkASSERT(fDebugBaseMin >= t || t >= fDebugBaseMax);
|
||||
if (fDebugLastMax < 0 || fDebugLastIndex == index) {
|
||||
fDebugLastIndex = index;
|
||||
@ -1840,8 +1840,8 @@ void SkOpCoincidence::debugAddOrOverlap(SkPathOpsDebug::GlitchLog* log,
|
||||
}
|
||||
this->debugValidate();
|
||||
RETURN_FALSE_IF(csDeleted, coinSeg);
|
||||
RETURN_FALSE_IF(osDeleted, oppSeg);
|
||||
RETURN_FALSE_IF(ceDeleted, coinSeg);
|
||||
RETURN_FALSE_IF(osDeleted, oppSeg);
|
||||
RETURN_FALSE_IF(ceDeleted, coinSeg);
|
||||
RETURN_FALSE_IF(oeDeleted, oppSeg);
|
||||
RETURN_FALSE_IF(!cs || !ce || cs == ce || cs->contains(ce) || !os || !oe || os == oe || os->contains(oe), coinSeg);
|
||||
bool result = true;
|
||||
@ -2508,7 +2508,7 @@ void SkOpSpanBase::debugMergeMatches(SkPathOpsDebug::GlitchLog* log, const SkOpS
|
||||
}
|
||||
const SkOpSpanBase* innerBase = inner->span();
|
||||
SkASSERT(innerBase->ptT() == inner);
|
||||
// when the intersection is first detected, the span base is marked if there are
|
||||
// when the intersection is first detected, the span base is marked if there are
|
||||
// more than one point in the intersection.
|
||||
// if (!innerBase->hasMultipleHint() && !testBase->hasMultipleHint()) {
|
||||
if (!zero_or_one(inner->fT)) {
|
||||
@ -2537,7 +2537,7 @@ void SkOpSpanBase::debugMergeMatches(SkPathOpsDebug::GlitchLog* log, const SkOpS
|
||||
SkOPASSERT(0);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
break;
|
||||
// }
|
||||
break;
|
||||
} while ((inner = inner->next()) != innerStop);
|
||||
@ -2793,13 +2793,13 @@ const SkOpPtT* SkOpPtT::debugOppPrev(const SkOpPtT* opp) const {
|
||||
|
||||
void SkOpPtT::debugResetCoinT() const {
|
||||
#if DEBUG_COINCIDENCE_ORDER
|
||||
this->segment()->debugResetCoinT();
|
||||
this->segment()->debugResetCoinT();
|
||||
#endif
|
||||
}
|
||||
|
||||
void SkOpPtT::debugSetCoinT(int index) const {
|
||||
#if DEBUG_COINCIDENCE_ORDER
|
||||
this->segment()->debugSetCoinT(index, fT);
|
||||
this->segment()->debugSetCoinT(index, fT);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@ class SkOpContourHead;
|
||||
extern int gDumpTSectNum;
|
||||
#endif
|
||||
|
||||
#if DEBUG_COINCIDENCE || DEBUG_COINCIDENCE_DUMP
|
||||
#if DEBUG_COINCIDENCE || DEBUG_COINCIDENCE_DUMP
|
||||
#define DEBUG_COIN 1
|
||||
#else
|
||||
#define DEBUG_COIN 0
|
||||
|
@ -8,54 +8,54 @@
|
||||
#include "SkPathOpsTSect.h"
|
||||
|
||||
int SkIntersections::intersect(const SkDQuad& quad1, const SkDQuad& quad2) {
|
||||
SkTSect<SkDQuad, SkDQuad> sect1(quad1
|
||||
SkTSect<SkDQuad, SkDQuad> sect1(quad1
|
||||
SkDEBUGPARAMS(globalState()) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
|
||||
SkTSect<SkDQuad, SkDQuad> sect2(quad2
|
||||
SkTSect<SkDQuad, SkDQuad> sect2(quad2
|
||||
SkDEBUGPARAMS(globalState()) PATH_OPS_DEBUG_T_SECT_PARAMS(2));
|
||||
SkTSect<SkDQuad, SkDQuad>::BinarySearch(§1, §2, this);
|
||||
return used();
|
||||
}
|
||||
|
||||
int SkIntersections::intersect(const SkDConic& conic, const SkDQuad& quad) {
|
||||
SkTSect<SkDConic, SkDQuad> sect1(conic
|
||||
SkTSect<SkDConic, SkDQuad> sect1(conic
|
||||
SkDEBUGPARAMS(globalState()) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
|
||||
SkTSect<SkDQuad, SkDConic> sect2(quad
|
||||
SkTSect<SkDQuad, SkDConic> sect2(quad
|
||||
SkDEBUGPARAMS(globalState()) PATH_OPS_DEBUG_T_SECT_PARAMS(2));
|
||||
SkTSect<SkDConic, SkDQuad>::BinarySearch(§1, §2, this);
|
||||
return used();
|
||||
}
|
||||
|
||||
int SkIntersections::intersect(const SkDConic& conic1, const SkDConic& conic2) {
|
||||
SkTSect<SkDConic, SkDConic> sect1(conic1
|
||||
SkTSect<SkDConic, SkDConic> sect1(conic1
|
||||
SkDEBUGPARAMS(globalState()) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
|
||||
SkTSect<SkDConic, SkDConic> sect2(conic2
|
||||
SkTSect<SkDConic, SkDConic> sect2(conic2
|
||||
SkDEBUGPARAMS(globalState()) PATH_OPS_DEBUG_T_SECT_PARAMS(2));
|
||||
SkTSect<SkDConic, SkDConic>::BinarySearch(§1, §2, this);
|
||||
return used();
|
||||
}
|
||||
|
||||
int SkIntersections::intersect(const SkDCubic& cubic, const SkDQuad& quad) {
|
||||
SkTSect<SkDCubic, SkDQuad> sect1(cubic
|
||||
SkTSect<SkDCubic, SkDQuad> sect1(cubic
|
||||
SkDEBUGPARAMS(globalState()) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
|
||||
SkTSect<SkDQuad, SkDCubic> sect2(quad
|
||||
SkTSect<SkDQuad, SkDCubic> sect2(quad
|
||||
SkDEBUGPARAMS(globalState()) PATH_OPS_DEBUG_T_SECT_PARAMS(2));
|
||||
SkTSect<SkDCubic, SkDQuad>::BinarySearch(§1, §2, this);
|
||||
return used();
|
||||
}
|
||||
|
||||
int SkIntersections::intersect(const SkDCubic& cubic, const SkDConic& conic) {
|
||||
SkTSect<SkDCubic, SkDConic> sect1(cubic
|
||||
SkTSect<SkDCubic, SkDConic> sect1(cubic
|
||||
SkDEBUGPARAMS(globalState()) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
|
||||
SkTSect<SkDConic, SkDCubic> sect2(conic
|
||||
SkTSect<SkDConic, SkDCubic> sect2(conic
|
||||
SkDEBUGPARAMS(globalState()) PATH_OPS_DEBUG_T_SECT_PARAMS(2));
|
||||
SkTSect<SkDCubic, SkDConic>::BinarySearch(§1, §2, this);
|
||||
return used();
|
||||
}
|
||||
|
||||
int SkIntersections::intersect(const SkDCubic& cubic1, const SkDCubic& cubic2) {
|
||||
SkTSect<SkDCubic, SkDCubic> sect1(cubic1
|
||||
SkTSect<SkDCubic, SkDCubic> sect1(cubic1
|
||||
SkDEBUGPARAMS(globalState()) PATH_OPS_DEBUG_T_SECT_PARAMS(1));
|
||||
SkTSect<SkDCubic, SkDCubic> sect2(cubic2
|
||||
SkTSect<SkDCubic, SkDCubic> sect2(cubic2
|
||||
SkDEBUGPARAMS(globalState()) PATH_OPS_DEBUG_T_SECT_PARAMS(2));
|
||||
SkTSect<SkDCubic, SkDCubic>::BinarySearch(§1, §2, this);
|
||||
return used();
|
||||
|
@ -237,7 +237,7 @@ void SkPathWriter::assemble() {
|
||||
double dist = dx * dx + dy * dy;
|
||||
distLookup.push_back(rRow + iIndex);
|
||||
distances.push_back(dist); // oStart distance from iStart
|
||||
sortedDist.push_back(dIndex++);
|
||||
sortedDist.push_back(dIndex++);
|
||||
}
|
||||
rRow += endCount;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ private:
|
||||
bool someAssemblyRequired();
|
||||
void update(const SkOpPtT* pt);
|
||||
|
||||
SkPath fCurrent; // contour under construction
|
||||
SkPath fCurrent; // contour under construction
|
||||
SkTArray<SkPath> fPartials; // contours with mismatched starts and ends
|
||||
SkTDArray<const SkOpPtT*> fEndPtTs; // possible pt values for partial starts and ends
|
||||
SkPath* fPathPtr; // closed contours are written here
|
||||
|
@ -154,7 +154,7 @@ protected:
|
||||
const SkPaint*) override;
|
||||
void onDrawBitmapLattice(const SkBitmap&, const Lattice& lattice, const SkRect& dst,
|
||||
const SkPaint*) override;
|
||||
|
||||
|
||||
private:
|
||||
SkPipeDeduper* fDeduper;
|
||||
SkWStream* fStream;
|
||||
|
@ -17,7 +17,7 @@ enum class SkPipeVerb : uint8_t {
|
||||
kSaveLayer,
|
||||
kRestore, // extra == 0
|
||||
kConcat, // extra == SkMatrix::MaskType
|
||||
|
||||
|
||||
kClipRect, // extra == (SkRegion::Op << 1) | isAntiAlias:1
|
||||
kClipRRect, // extra == (SkRegion::Op << 1) | isAntiAlias:1
|
||||
kClipPath, // extra == (SkRegion::Op << 1) | isAntiAlias:1
|
||||
@ -40,14 +40,14 @@ enum class SkPipeVerb : uint8_t {
|
||||
kDrawPath, // extra == 0
|
||||
kDrawOval, // extra == 0
|
||||
kDrawRRect, // extra == 0
|
||||
|
||||
|
||||
kDrawImage, // extra == has_paint:1
|
||||
kDrawImageRect, // extra == constraint | has_src_rect | has_paint
|
||||
kDrawImageNine, // extra == has_paint:1
|
||||
kDrawImageLattice, // extra == x_count:8 | y_count:8 | has_paint:1
|
||||
|
||||
|
||||
kDrawVertices,
|
||||
|
||||
|
||||
kDrawPicture, // extra == picture_index
|
||||
kDrawAnnotation, // extra == (key_len_plus_1:23 << 1) else next 32 | has_data:1
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user