fix bookmaker nightly

still investigating why MakeFromTexture example
crashes.

TBR=reed@google.com
NOTRY=true
Docs-Preview: https://skia.org/?cl=159149
Bug: skia:
Change-Id: I3d3b66ed7d1af76a67115fbee99410c81003859f
Reviewed-on: https://skia-review.googlesource.com/c/159149
Commit-Queue: Cary Clark <caryclark@google.com>
Auto-Submit: Cary Clark <caryclark@google.com>
Reviewed-by: Cary Clark <caryclark@google.com>
This commit is contained in:
Cary Clark 2018-10-03 10:44:13 -04:00 committed by Skia Commit-Bot
parent 964aedb5e3
commit 08417bccf2
5 changed files with 239 additions and 235 deletions

View File

@ -453,7 +453,8 @@ if (!context) {
return;
}
auto debugster = [](SkImage::ReleaseContext releaseContext) -> void {
*((int *) releaseContext) += 128;
// broken
// *((int *) releaseContext) += 128;
};
int x = 0;
for (auto origin : { kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin } ) {

View File

@ -454,76 +454,76 @@ void draw(SkCanvas* canvas) {
#Width 812
#Height 685
void draw(SkCanvas* canvas) {
canvas->scale(1.25f, 1.25f);
SkPaint paint;
paint.setAntiAlias(true);
paint.setTextSize(10);
paint.setTextAlign(SkPaint::kCenter_Align);
canvas->drawString("128-bit word", 5 + 20 * 16, 20, paint);
canvas->drawString("little endian byte order", 5 + 20 * 4, 135, paint);
for (int i = 0; i < 4; ++i) {
canvas->drawString("(low bits)", 5 + 10 * 4, 187 + i * 100, paint);
canvas->drawString("(high bits)", 105 + 10 * 4, 237 + i * 100, paint);
}
auto drawBoxText = [=](SkScalar e[], const char* s[], const char* nums[] ,
int count, int n, SkScalar yPos) -> void {
SkPaint p(paint);
p.setColor(SK_ColorRED);
SkScalar xPos = 15;
int stringIndex = 0;
for (int i = n; i >= 0; --i) {
if (0 == i || n == i || 32 == i || 31 == i) {
int x = xPos;
if (2 == count) {
x += stringIndex * 12 + (stringIndex ? 8 : 0);
}
canvas->drawString(nums[stringIndex], x, yPos - 5, p);
if (1 == count) {
canvas->drawString(nums[stringIndex], xPos + 100, yPos - 5, p);
}
++stringIndex;
}
xPos += 9;
}
p.setColor(SK_ColorBLACK);
for (int i = 0; i < count; ++i) {
canvas->drawString(s[i], 5 + (e[i] + e[i + 1]) * 5, yPos + 10, p);
if (1 == count) {
canvas->drawString(s[i], 105 + (e[i] + e[i + 1]) * 5, yPos + 10, p);
}
}
p.setStyle(SkPaint::kStroke_Style);
for (int i = 0; i <= count; ++i) {
canvas->drawLine(5 + e[i] * 10, yPos, 5 + e[i] * 10, yPos + 15, p);
if (1 == count) {
canvas->drawLine(105 + e[i] * 10, yPos, 105 + e[i] * 10, yPos + 15, p);
}
}
for (int i = 0; i < 2; ++i) {
canvas->drawLine(5 + e[0] * 10, yPos + i * 15,
5 + e[count] * 10, yPos + i * 15, p);
if (1 == count) {
canvas->drawLine(105 + e[0] * 10, yPos + i * 15,
105 + e[count] * 10, yPos + i * 15, p);
}
}
};
SkScalar edges[] = { 0, 32, 64,
0, 8
};
const char* labels[] = { "alpha", "blue", "green", "red" };
const char* nums128[] = { "127", "96", "95", "64"};
const char* nums64[] = { "63", "32", "31", "0"};
const char* nums8[] = { "7", "0"};
drawBoxText(&edges[0], &labels[0], nums128, 2, 63, 45);
drawBoxText(&edges[0], &labels[2], nums64, 2, 63, 95);
drawBoxText(&edges[3], &labels[3], nums8, 1, 7, 160);
drawBoxText(&edges[3], &labels[3], nums8, 1, 7, 210);
drawBoxText(&edges[3], &labels[2], nums8, 1, 7, 260);
drawBoxText(&edges[3], &labels[2], nums8, 1, 7, 310);
drawBoxText(&edges[3], &labels[1], nums8, 1, 7, 360);
drawBoxText(&edges[3], &labels[1], nums8, 1, 7, 410);
drawBoxText(&edges[3], &labels[0], nums8, 1, 7, 460);
canvas->scale(1.25f, 1.25f);
SkPaint paint;
paint.setAntiAlias(true);
paint.setTextSize(10);
paint.setTextAlign(SkPaint::kCenter_Align);
canvas->drawString("128-bit word", 5 + 20 * 16, 20, paint);
canvas->drawString("little endian byte order", 5 + 20 * 4, 135, paint);
for (int i = 0; i < 4; ++i) {
canvas->drawString("(low bits)", 5 + 10 * 4, 187 + i * 100, paint);
canvas->drawString("(high bits)", 105 + 10 * 4, 237 + i * 100, paint);
}
auto drawBoxText = [=](SkScalar e[], const char* s[], const char* nums[] ,
int count, int n, SkScalar yPos) -> void {
SkPaint p(paint);
p.setColor(SK_ColorRED);
SkScalar xPos = 15;
int stringIndex = 0;
for (int i = n; i >= 0; --i) {
if (0 == i || n == i || 32 == i || 31 == i) {
int x = xPos;
if (2 == count) {
x += stringIndex * 12 + (stringIndex ? 8 : 0);
}
canvas->drawString(nums[stringIndex], x, yPos - 5, p);
if (1 == count) {
canvas->drawString(nums[stringIndex], xPos + 100, yPos - 5, p);
}
++stringIndex;
}
xPos += 9;
}
p.setColor(SK_ColorBLACK);
for (int i = 0; i < count; ++i) {
canvas->drawString(s[i], 5 + (e[i] + e[i + 1]) * 5, yPos + 10, p);
if (1 == count) {
canvas->drawString(s[i], 105 + (e[i] + e[i + 1]) * 5, yPos + 10, p);
}
}
p.setStyle(SkPaint::kStroke_Style);
for (int i = 0; i <= count; ++i) {
canvas->drawLine(5 + e[i] * 10, yPos, 5 + e[i] * 10, yPos + 15, p);
if (1 == count) {
canvas->drawLine(105 + e[i] * 10, yPos, 105 + e[i] * 10, yPos + 15, p);
}
}
for (int i = 0; i < 2; ++i) {
canvas->drawLine(5 + e[0] * 10, yPos + i * 15,
5 + e[count] * 10, yPos + i * 15, p);
if (1 == count) {
canvas->drawLine(105 + e[0] * 10, yPos + i * 15,
105 + e[count] * 10, yPos + i * 15, p);
}
}
};
SkScalar edges[] = { 0, 32, 64,
0, 8
};
const char* labels[] = { "alpha", "blue", "green", "red" };
const char* nums128[] = { "127", "96", "95", "64"};
const char* nums64[] = { "63", "32", "31", "0"};
const char* nums8[] = { "7", "0"};
drawBoxText(&edges[0], &labels[0], nums128, 2, 63, 45);
drawBoxText(&edges[0], &labels[2], nums64, 2, 63, 95);
drawBoxText(&edges[3], &labels[3], nums8, 1, 7, 160);
drawBoxText(&edges[3], &labels[3], nums8, 1, 7, 210);
drawBoxText(&edges[3], &labels[2], nums8, 1, 7, 260);
drawBoxText(&edges[3], &labels[2], nums8, 1, 7, 310);
drawBoxText(&edges[3], &labels[1], nums8, 1, 7, 360);
drawBoxText(&edges[3], &labels[1], nums8, 1, 7, 410);
drawBoxText(&edges[3], &labels[0], nums8, 1, 7, 460);
drawBoxText(&edges[3], &labels[0], nums8, 1, 7, 510);
}
##
@ -533,40 +533,40 @@ void draw(SkCanvas* canvas) {
#Example
#Width 480
#Height 330
SkPaint srcPaint;
srcPaint.setAntiAlias(true);
SkPaint labelPaint = srcPaint;
labelPaint.setTextAlign(SkPaint::kCenter_Align);
labelPaint.setTextSize(16);
SkPaint dstPaint = labelPaint;
dstPaint.setTextSize(80);
dstPaint.setColor(0xFF606080);
dstPaint.setTypeface(SkTypeface::MakeFromName("Roboto", SkFontStyle::Bold()));
SkBitmap srcBits;
srcBits.allocN32Pixels(80, 84);
SkCanvas srcCanvas(srcBits);
srcPaint.setColor(0xFFcc6633);
SkPath srcPath;
const SkPoint points[] = {{20, 20}, {80, 45}, {45, 80}};
srcPath.addPoly(points, SK_ARRAY_COUNT(points), true);
srcBits.eraseColor(0);
srcCanvas.drawPath(srcPath, srcPaint);
canvas->drawColor(0, SkBlendMode::kClear);
for (auto blend : { SkBlendMode::kSrc, SkBlendMode::kSrcATop, SkBlendMode::kSrcOver,
SkBlendMode::kSrcIn, SkBlendMode::kSrcOut,
SkBlendMode::kDst, SkBlendMode::kDstATop, SkBlendMode::kDstOver,
SkBlendMode::kDstIn, SkBlendMode::kDstOut,
SkBlendMode::kClear, SkBlendMode::kXor } ) {
canvas->drawString("&", 50, 80, dstPaint);
srcPaint.setBlendMode(blend);
canvas->drawBitmap(srcBits, 0, 0, &srcPaint);
canvas->drawString(SkBlendMode_Name(blend), 50, 100, labelPaint);
canvas->translate(80, 0);
if (SkBlendMode::kSrcOut == blend || SkBlendMode::kDstOut == blend) {
canvas->translate(-80 * 5, 100);
}
SkPaint srcPaint;
srcPaint.setAntiAlias(true);
SkPaint labelPaint = srcPaint;
labelPaint.setTextAlign(SkPaint::kCenter_Align);
labelPaint.setTextSize(16);
SkPaint dstPaint = labelPaint;
dstPaint.setTextSize(80);
dstPaint.setColor(0xFF606080);
dstPaint.setTypeface(SkTypeface::MakeFromName("Roboto", SkFontStyle::Bold()));
SkBitmap srcBits;
srcBits.allocN32Pixels(80, 84);
SkCanvas srcCanvas(srcBits);
srcPaint.setColor(0xFFcc6633);
SkPath srcPath;
const SkPoint points[] = {{20, 20}, {80, 45}, {45, 80}};
srcPath.addPoly(points, SK_ARRAY_COUNT(points), true);
srcBits.eraseColor(0);
srcCanvas.drawPath(srcPath, srcPaint);
canvas->drawColor(0, SkBlendMode::kClear);
for (auto blend : { SkBlendMode::kSrc, SkBlendMode::kSrcATop, SkBlendMode::kSrcOver,
SkBlendMode::kSrcIn, SkBlendMode::kSrcOut,
SkBlendMode::kDst, SkBlendMode::kDstATop, SkBlendMode::kDstOver,
SkBlendMode::kDstIn, SkBlendMode::kDstOut,
SkBlendMode::kClear, SkBlendMode::kXor } ) {
canvas->drawString("&", 50, 80, dstPaint);
srcPaint.setBlendMode(blend);
canvas->drawBitmap(srcBits, 0, 0, &srcPaint);
canvas->drawString(SkBlendMode_Name(blend), 50, 100, labelPaint);
canvas->translate(80, 0);
if (SkBlendMode::kSrcOut == blend || SkBlendMode::kDstOut == blend) {
canvas->translate(-80 * 5, 100);
}
}
##
##
@ -575,38 +575,38 @@ void draw(SkCanvas* canvas) {
#Example
#Width 480
#Height 330
SkPaint srcPaint;
srcPaint.setAntiAlias(true);
SkPaint labelPaint = srcPaint;
labelPaint.setTextAlign(SkPaint::kCenter_Align);
labelPaint.setTextSize(16);
SkPaint dstPaint = labelPaint;
dstPaint.setTextSize(80);
dstPaint.setColor(0xFF606080);
dstPaint.setTypeface(SkTypeface::MakeFromName("Roboto", SkFontStyle::Bold()));
srcPaint.setColor(0xFFcc6633);
SkPath srcPath;
const SkPoint points[] = {{20, 20}, {80, 45}, {45, 80}};
srcPath.addPoly(points, SK_ARRAY_COUNT(points), true);
canvas->drawColor(0, SkBlendMode::kClear);
SkBitmap dstBits;
dstBits.allocN32Pixels(80, 80);
SkCanvas dstCanvas(dstBits);
for (auto blend : { SkBlendMode::kSrc, SkBlendMode::kSrcATop, SkBlendMode::kSrcOver,
SkBlendMode::kSrcIn, SkBlendMode::kSrcOut,
SkBlendMode::kDst, SkBlendMode::kDstATop, SkBlendMode::kDstOver,
SkBlendMode::kDstIn, SkBlendMode::kDstOut,
SkBlendMode::kClear, SkBlendMode::kXor } ) {
canvas->drawString("&", 50, 80, dstPaint);
srcPaint.setBlendMode(blend);
canvas->drawPath(srcPath, srcPaint);
canvas->drawString(SkBlendMode_Name(blend), 50, 100, labelPaint);
canvas->translate(80, 0);
if (SkBlendMode::kSrcOut == blend || SkBlendMode::kDstOut == blend) {
canvas->translate(-80 * 5, 100);
}
SkPaint srcPaint;
srcPaint.setAntiAlias(true);
SkPaint labelPaint = srcPaint;
labelPaint.setTextAlign(SkPaint::kCenter_Align);
labelPaint.setTextSize(16);
SkPaint dstPaint = labelPaint;
dstPaint.setTextSize(80);
dstPaint.setColor(0xFF606080);
dstPaint.setTypeface(SkTypeface::MakeFromName("Roboto", SkFontStyle::Bold()));
srcPaint.setColor(0xFFcc6633);
SkPath srcPath;
const SkPoint points[] = {{20, 20}, {80, 45}, {45, 80}};
srcPath.addPoly(points, SK_ARRAY_COUNT(points), true);
canvas->drawColor(0, SkBlendMode::kClear);
SkBitmap dstBits;
dstBits.allocN32Pixels(80, 80);
SkCanvas dstCanvas(dstBits);
for (auto blend : { SkBlendMode::kSrc, SkBlendMode::kSrcATop, SkBlendMode::kSrcOver,
SkBlendMode::kSrcIn, SkBlendMode::kSrcOut,
SkBlendMode::kDst, SkBlendMode::kDstATop, SkBlendMode::kDstOver,
SkBlendMode::kDstIn, SkBlendMode::kDstOut,
SkBlendMode::kClear, SkBlendMode::kXor } ) {
canvas->drawString("&", 50, 80, dstPaint);
srcPaint.setBlendMode(blend);
canvas->drawPath(srcPath, srcPaint);
canvas->drawString(SkBlendMode_Name(blend), 50, 100, labelPaint);
canvas->translate(80, 0);
if (SkBlendMode::kSrcOut == blend || SkBlendMode::kDstOut == blend) {
canvas->translate(-80 * 5, 100);
}
}
##
##
@ -615,34 +615,34 @@ void draw(SkCanvas* canvas) {
#Example
#Width 480
#Height 330
SkPaint srcPaint;
srcPaint.setAntiAlias(true);
SkPaint labelPaint = srcPaint;
labelPaint.setTextAlign(SkPaint::kCenter_Align);
labelPaint.setTextSize(16);
SkPaint dstPaint = labelPaint;
dstPaint.setTextSize(80);
dstPaint.setColor(0xFF606080);
dstPaint.setTypeface(SkTypeface::MakeFromName("Roboto", SkFontStyle::Bold()));
srcPaint.setColor(0xFFcc6633);
SkPath srcPath;
const SkPoint points[] = {{20, 20}, {80, 45}, {45, 80}};
srcPath.addPoly(points, SK_ARRAY_COUNT(points), true);
canvas->drawColor(0, SkBlendMode::kClear);
for (auto blend : { SkBlendMode::kPlus, SkBlendMode::kScreen, SkBlendMode::kOverlay,
SkBlendMode::kDarken, SkBlendMode::kLighten, SkBlendMode::kColorDodge,
SkBlendMode::kColorBurn, SkBlendMode::kHardLight, SkBlendMode::kSoftLight,
SkBlendMode::kDifference, SkBlendMode::kExclusion, SkBlendMode::kMultiply } ) {
canvas->drawString("&", 50, 80, dstPaint);
srcPaint.setBlendMode(blend);
canvas->drawPath(srcPath, srcPaint);
canvas->drawString(SkBlendMode_Name(blend), 50, 100, labelPaint);
canvas->translate(90, 0);
if (SkBlendMode::kLighten == blend || SkBlendMode::kDifference == blend) {
canvas->translate(-90 * 5, 100);
}
}
SkPaint srcPaint;
srcPaint.setAntiAlias(true);
SkPaint labelPaint = srcPaint;
labelPaint.setTextAlign(SkPaint::kCenter_Align);
labelPaint.setTextSize(16);
SkPaint dstPaint = labelPaint;
dstPaint.setTextSize(80);
dstPaint.setColor(0xFF606080);
dstPaint.setTypeface(SkTypeface::MakeFromName("Roboto", SkFontStyle::Bold()));
srcPaint.setColor(0xFFcc6633);
SkPath srcPath;
const SkPoint points[] = {{20, 20}, {80, 45}, {45, 80}};
srcPath.addPoly(points, SK_ARRAY_COUNT(points), true);
canvas->drawColor(0, SkBlendMode::kClear);
for (auto blend : { SkBlendMode::kPlus, SkBlendMode::kScreen, SkBlendMode::kOverlay,
SkBlendMode::kDarken, SkBlendMode::kLighten, SkBlendMode::kColorDodge,
SkBlendMode::kColorBurn, SkBlendMode::kHardLight, SkBlendMode::kSoftLight,
SkBlendMode::kDifference, SkBlendMode::kExclusion, SkBlendMode::kMultiply } ) {
canvas->drawString("&", 50, 80, dstPaint);
srcPaint.setBlendMode(blend);
canvas->drawPath(srcPath, srcPaint);
canvas->drawString(SkBlendMode_Name(blend), 50, 100, labelPaint);
canvas->translate(90, 0);
if (SkBlendMode::kLighten == blend || SkBlendMode::kDifference == blend) {
canvas->translate(-90 * 5, 100);
}
}
##
##
@ -650,29 +650,29 @@ void draw(SkCanvas* canvas) {
#Example
#Width 480
#Height 110
SkPaint srcPaint;
srcPaint.setAntiAlias(true);
SkPaint labelPaint = srcPaint;
labelPaint.setTextAlign(SkPaint::kCenter_Align);
labelPaint.setTextSize(16);
SkPaint dstPaint = labelPaint;
dstPaint.setTextSize(80);
dstPaint.setColor(0xFF606080);
dstPaint.setTypeface(SkTypeface::MakeFromName("Roboto", SkFontStyle::Bold()));
srcPaint.setColor(0xFFcc6633);
SkPath srcPath;
const SkPoint points[] = {{20, 20}, {80, 45}, {45, 80}};
srcPath.addPoly(points, SK_ARRAY_COUNT(points), true);
canvas->drawColor(0, SkBlendMode::kClear);
for (auto blend : { SkBlendMode::kHue, SkBlendMode::kSaturation, SkBlendMode::kColor,
SkBlendMode::kLuminosity } ) {
canvas->drawString("&", 50, 80, dstPaint);
srcPaint.setBlendMode(blend);
canvas->drawPath(srcPath, srcPaint);
canvas->drawString(SkBlendMode_Name(blend), 50, 100, labelPaint);
canvas->translate(90, 0);
}
SkPaint srcPaint;
srcPaint.setAntiAlias(true);
SkPaint labelPaint = srcPaint;
labelPaint.setTextAlign(SkPaint::kCenter_Align);
labelPaint.setTextSize(16);
SkPaint dstPaint = labelPaint;
dstPaint.setTextSize(80);
dstPaint.setColor(0xFF606080);
dstPaint.setTypeface(SkTypeface::MakeFromName("Roboto", SkFontStyle::Bold()));
srcPaint.setColor(0xFFcc6633);
SkPath srcPath;
const SkPoint points[] = {{20, 20}, {80, 45}, {45, 80}};
srcPath.addPoly(points, SK_ARRAY_COUNT(points), true);
canvas->drawColor(0, SkBlendMode::kClear);
for (auto blend : { SkBlendMode::kHue, SkBlendMode::kSaturation, SkBlendMode::kColor,
SkBlendMode::kLuminosity } ) {
canvas->drawString("&", 50, 80, dstPaint);
srcPaint.setBlendMode(blend);
canvas->drawPath(srcPath, srcPaint);
canvas->drawString(SkBlendMode_Name(blend), 50, 100, labelPaint);
canvas->translate(90, 0);
}
##
##
@ -680,40 +680,40 @@ void draw(SkCanvas* canvas) {
#Example
#Width 480
#Height 110
SkPaint srcPaint;
srcPaint.setAntiAlias(true);
SkPaint labelPaint = srcPaint;
labelPaint.setTextAlign(SkPaint::kCenter_Align);
labelPaint.setTextSize(16);
SkPaint dstPaint = labelPaint;
dstPaint.setTextSize(80);
dstPaint.setColor(0xFF606080);
dstPaint.setTypeface(SkTypeface::MakeFromName("Roboto", SkFontStyle::Bold()));
SkBitmap srcBits;
srcBits.allocN32Pixels(80, 84);
SkCanvas srcCanvas(srcBits);
srcPaint.setColor(0xFFcc6633);
SkPath srcPath;
const SkPoint points[] = {{20, 20}, {80, 45}, {45, 80}};
srcPath.addPoly(points, SK_ARRAY_COUNT(points), true);
srcBits.eraseColor(0);
srcCanvas.drawPath(srcPath, srcPaint);
canvas->drawColor(0, SkBlendMode::kClear);
srcPaint.setBlendMode(SkBlendMode::kModulate);
for (auto step: { 1, 2 } ) {
canvas->drawString("&", 50, 80, dstPaint);
if (1 == step) {
canvas->drawBitmap(srcBits, 0, 0, &srcPaint);
canvas->drawString("Bitmap", 50, 18, labelPaint);
} else {
canvas->drawPath(srcPath, srcPaint);
canvas->drawString("Geometry", 50, 18, labelPaint);
}
canvas->drawString(SkBlendMode_Name(SkBlendMode::kModulate), 50, 100, labelPaint);
canvas->translate(120, 0);
}
SkPaint srcPaint;
srcPaint.setAntiAlias(true);
SkPaint labelPaint = srcPaint;
labelPaint.setTextAlign(SkPaint::kCenter_Align);
labelPaint.setTextSize(16);
SkPaint dstPaint = labelPaint;
dstPaint.setTextSize(80);
dstPaint.setColor(0xFF606080);
dstPaint.setTypeface(SkTypeface::MakeFromName("Roboto", SkFontStyle::Bold()));
SkBitmap srcBits;
srcBits.allocN32Pixels(80, 84);
SkCanvas srcCanvas(srcBits);
srcPaint.setColor(0xFFcc6633);
SkPath srcPath;
const SkPoint points[] = {{20, 20}, {80, 45}, {45, 80}};
srcPath.addPoly(points, SK_ARRAY_COUNT(points), true);
srcBits.eraseColor(0);
srcCanvas.drawPath(srcPath, srcPaint);
canvas->drawColor(0, SkBlendMode::kClear);
srcPaint.setBlendMode(SkBlendMode::kModulate);
for (auto step: { 1, 2 } ) {
canvas->drawString("&", 50, 80, dstPaint);
if (1 == step) {
canvas->drawBitmap(srcBits, 0, 0, &srcPaint);
canvas->drawString("Bitmap", 50, 18, labelPaint);
} else {
canvas->drawPath(srcPath, srcPaint);
canvas->drawString("Geometry", 50, 18, labelPaint);
}
canvas->drawString(SkBlendMode_Name(SkBlendMode::kModulate), 50, 100, labelPaint);
canvas->translate(120, 0);
}
##
##
@ -724,7 +724,7 @@ void draw(SkCanvas* canvas) {
#Width 600
#Function
###$
#include "SkTextOnPath.h"
struct data {
const char* name;
char super;
@ -778,13 +778,16 @@ void draw(SkCanvas* canvas) {
if (0 == col) {
continue;
}
canvas->drawLine(tl + col * 35, 100, tl + 100 + col * 35, 0, lp);
SkPath path;
path.moveTo(tl - 3 + col * 35, 103);
path.lineTo(tl + 124 + col * 35, -24);
canvas->drawLine( tl + col * 35, 100, tl + 100 + col * 35, 0, lp);
SkPoint pts[] = {{tl - 10.f + col * 35, 98}, {tl + 90.f + col * 35, -2}};
SkVector v = pts[1] - pts[0];
v.normalize();
SkMatrix matrix;
matrix.setTranslate(0, -9);
SkDrawTextOnPath(headers[col -1], strlen(headers[col -1]), bp, path, &matrix, canvas);
matrix.setSinCos(v.fY, v.fX, pts[0].fX, pts[0].fY);
canvas->save();
canvas->concat(matrix);
canvas->drawText(headers[col -1], strlen(headers[col -1]), pts[0].fX, pts[0].fY, bp);
canvas->restore();
}
for (unsigned row = 0; row <= SK_ARRAY_COUNT(dataSet); ++row) {
if (0 == row) {

View File

@ -892,7 +892,7 @@ created <a href='#Image'>Image</a>, or nullptr
### Example
<div><fiddle-embed name="c7be9423f7c2ef819523ba4d607d17b8" gpu="true"></fiddle-embed></div>
<div><fiddle-embed name="5af7b864b6ed8d96def81206124ac699" gpu="true"></fiddle-embed></div>
### See Also

View File

@ -3707,7 +3707,7 @@ so additional values choose a single solution. This construction is similar to <
<a href='#SkPath_conicTo'>conicTo</a> can represent any <a href='#Arc'>Arc</a> with a sweep less than 180 degrees at any rotation. All <a href='#SkPath_arcTo'>arcTo</a>
constructions are converted to <a href='#Conic'>Conic</a> data when added to <a href='#Path'>Path</a>.
![Arc](https://fiddle.skia.org/i/fe909570a3c42269b447b061158177b9_raster.png "")
![Arc](https://fiddle.skia.org/i/e17e48e9d2182e9afc0f5d26b72c60f0_raster.png "")
<table> <tr>
<td><sup>1</sup> <a href='#SkPath_arcTo'>arcTo(const SkRect& oval, SkScalar startAngle, SkScalar sweepAngle, bool forceMoveTo)</a></td>

View File

@ -4017,10 +4017,10 @@
"name": "Image_Info_Color_Type_RGB_888"
},
"Illustrations_Path_Arc": {
"code": "#include \"SkTextOnPath.h\"\nstruct data {\n const char* name;\n char super;\n int yn[10];\n};\nconst data dataSet[] = {\n{ \"arcTo sweep\", '1', {1, 3, 1, 0, 0, 0, 0, 1, 0, 0 }},\n{ \"drawArc\", 0, {1, -1, 1, 1, 1, 1, 1, 0, 0, 0 }},\n{ \"addArc\", 0, {1, 1, 1, 4, 0, 1, 1, 1, 0, 0 }},\n{ \"arcTo tangents\", '4', {0, 0, 0, 0, 0, 0, 0, 1, 1, 0 }},\n{ \"arcTo radii\", '5', {1, 0, 1, 0, 0, 0, 0, 1, 1, 0 }},\n{ \"conicTo\", 0, {1, 1, 0, 0, 0, 0, 0, 1, 1, 1 }}\n};\n#define __degree_symbol__ \"\\xC2\" \"\\xB0\"\nconst char* headers[] = {\n \"Oval part\",\n \"force moveTo\",\n \"can draw 180\" __degree_symbol__,\n \"can draw 360\" __degree_symbol__,\n \"can draw greater than 360\" __degree_symbol__,\n \"ignored if radius is zero\",\n \"ignored if sweep is zero\",\n \"requires Path\",\n \"describes rotation\",\n \"describes perspective\",\n};\nconst char* yna[] = {\n \"n/a\",\n \"no\",\n \"yes\"\n};\n\nvoid draw(SkCanvas* canvas) {\n SkPaint lp;\n lp.setAntiAlias(true);\n SkPaint tp(lp);\n SkPaint sp(tp);\n SkPaint bp(tp);\n bp.setFakeBoldText(true);\n sp.setTextSize(10);\n lp.setColor(SK_ColorGRAY);\n canvas->translate(0, 32);\n const int tl = 115;\n for (unsigned col = 0; col <= SK_ARRAY_COUNT(headers); ++col) {\n canvas->drawLine(tl + col * 35, 100, tl + col * 35, 250, lp);\n if (0 == col) {\n continue;\n }\n canvas->drawLine(tl + col * 35, 100, tl + 100 + col * 35, 0, lp);\n SkPath path;\n path.moveTo(tl - 3 + col * 35, 103);\n path.lineTo(tl + 124 + col * 35, -24);\n SkMatrix matrix;\n matrix.setTranslate(0, -9);\n SkDrawTextOnPath(headers[col -1], strlen(headers[col -1]), bp, path, &matrix, canvas);\n }\n for (unsigned row = 0; row <= SK_ARRAY_COUNT(dataSet); ++row) {\n if (0 == row) {\n canvas->drawLine(tl, 100, tl + 350, 100, lp);\n } else {\n canvas->drawLine(5, 100 + row * 25, tl + 350, 100 + row * 25, lp);\n }\n if (row == SK_ARRAY_COUNT(dataSet)) {\n break;\n }\n canvas->drawString(dataSet[row].name, 5, 117 + row * 25, bp);\n if (dataSet[row].super) {\n SkScalar width = bp.measureText(dataSet[row].name, strlen(dataSet[row].name));\n canvas->drawText(&dataSet[row].super, 1, 8 + width, 112 + row * 25, sp);\n }\n for (unsigned col = 0; col < SK_ARRAY_COUNT(headers); ++col) {\n int val = dataSet[row].yn[col];\n canvas->drawString(yna[SkTMin(2, val + 1)], tl + 5 + col * 35, 117 + row * 25, tp);\n if (val > 1) {\n char supe = '0' + val - 1;\n canvas->drawText(&supe, 1, tl + 25 + col * 35, 112 + row * 25, sp);\n }\n }\n }\n}\n",
"code": "struct data {\n const char* name;\n char super;\n int yn[10];\n};\nconst data dataSet[] = {\n{ \"arcTo sweep\", '1', {1, 3, 1, 0, 0, 0, 0, 1, 0, 0 }},\n{ \"drawArc\", 0, {1, -1, 1, 1, 1, 1, 1, 0, 0, 0 }},\n{ \"addArc\", 0, {1, 1, 1, 4, 0, 1, 1, 1, 0, 0 }},\n{ \"arcTo tangents\", '4', {0, 0, 0, 0, 0, 0, 0, 1, 1, 0 }},\n{ \"arcTo radii\", '5', {1, 0, 1, 0, 0, 0, 0, 1, 1, 0 }},\n{ \"conicTo\", 0, {1, 1, 0, 0, 0, 0, 0, 1, 1, 1 }}\n};\n#define __degree_symbol__ \"\\xC2\" \"\\xB0\"\nconst char* headers[] = {\n \"Oval part\",\n \"force moveTo\",\n \"can draw 180\" __degree_symbol__,\n \"can draw 360\" __degree_symbol__,\n \"can draw greater than 360\" __degree_symbol__,\n \"ignored if radius is zero\",\n \"ignored if sweep is zero\",\n \"requires Path\",\n \"describes rotation\",\n \"describes perspective\",\n};\nconst char* yna[] = {\n \"n/a\",\n \"no\",\n \"yes\"\n};\n\nvoid draw(SkCanvas* canvas) {\n SkPaint lp;\n lp.setAntiAlias(true);\n SkPaint tp(lp);\n SkPaint sp(tp);\n SkPaint bp(tp);\n bp.setFakeBoldText(true);\n sp.setTextSize(10);\n lp.setColor(SK_ColorGRAY);\n canvas->translate(0, 32);\n const int tl = 115;\n for (unsigned col = 0; col <= SK_ARRAY_COUNT(headers); ++col) {\n canvas->drawLine(tl + col * 35, 100, tl + col * 35, 250, lp);\n if (0 == col) {\n continue;\n }\n canvas->drawLine( tl + col * 35, 100, tl + 100 + col * 35, 0, lp);\n SkPoint pts[] = {{tl - 10.f + col * 35, 98}, {tl + 90.f + col * 35, -2}};\n SkVector v = pts[1] - pts[0];\n v.normalize();\n SkMatrix matrix;\n matrix.setSinCos(v.fY, v.fX, pts[0].fX, pts[0].fY);\n canvas->save();\n canvas->concat(matrix);\n canvas->drawText(headers[col -1], strlen(headers[col -1]), pts[0].fX, pts[0].fY, bp);\n canvas->restore();\n }\n for (unsigned row = 0; row <= SK_ARRAY_COUNT(dataSet); ++row) {\n if (0 == row) {\n canvas->drawLine(tl, 100, tl + 350, 100, lp);\n } else {\n canvas->drawLine(5, 100 + row * 25, tl + 350, 100 + row * 25, lp);\n }\n if (row == SK_ARRAY_COUNT(dataSet)) {\n break;\n }\n canvas->drawString(dataSet[row].name, 5, 117 + row * 25, bp);\n if (dataSet[row].super) {\n SkScalar width = bp.measureText(dataSet[row].name, strlen(dataSet[row].name));\n canvas->drawText(&dataSet[row].super, 1, 8 + width, 112 + row * 25, sp);\n }\n for (unsigned col = 0; col < SK_ARRAY_COUNT(headers); ++col) {\n int val = dataSet[row].yn[col];\n canvas->drawString(yna[SkTMin(2, val + 1)], tl + 5 + col * 35, 117 + row * 25, tp);\n if (val > 1) {\n char supe = '0' + val - 1;\n canvas->drawText(&supe, 1, tl + 25 + col * 35, 112 + row * 25, sp);\n }\n }\n }\n}\n",
"width": 600,
"height": 300,
"hash": "fe909570a3c42269b447b061158177b9",
"hash": "e17e48e9d2182e9afc0f5d26b72c60f0",
"file": "illustrations",
"name": "Path_Arc"
},
@ -6153,10 +6153,10 @@
"name": "SkImage::MakeFromTexture"
},
"SkImage_MakeFromTexture_2": {
"code": "void draw(SkCanvas* canvas) {\n GrContext* context = canvas->getGrContext();\n if (!context) {\n return;\n }\n auto debugster = [](SkImage::ReleaseContext releaseContext) -> void {\n *((int *) releaseContext) += 128;\n };\n int x = 0;\n for (auto origin : { kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin } ) {\n sk_sp<SkImage> image = SkImage::MakeFromTexture(context, backEndTexture,\n origin, kRGBA_8888_SkColorType, kOpaque_SkAlphaType, nullptr, debugster, &x);\n canvas->drawImage(image, x, 0);\n x += 128;\n }\n}",
"code": "void draw(SkCanvas* canvas) {\n GrContext* context = canvas->getGrContext();\n if (!context) {\n return;\n }\n auto debugster = [](SkImage::ReleaseContext releaseContext) -> void {\n // broken \n // *((int *) releaseContext) += 128;\n };\n int x = 0;\n for (auto origin : { kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin } ) {\n sk_sp<SkImage> image = SkImage::MakeFromTexture(context, backEndTexture,\n origin, kRGBA_8888_SkColorType, kOpaque_SkAlphaType, nullptr, debugster, &x);\n canvas->drawImage(image, x, 0);\n x += 128;\n }\n}",
"width": 256,
"height": 256,
"hash": "c7be9423f7c2ef819523ba4d607d17b8",
"hash": "5af7b864b6ed8d96def81206124ac699",
"file": "SkImage_Reference",
"name": "SkImage::MakeFromTexture_2"
},