Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Unified Diff: src/core/SkCanvas.cpp

Issue 207683004: Extract most of the mutable state of SkShader into a separate Context object. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkBlitter_RGB16.cpp ('k') | src/core/SkComposeShader.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkCanvas.cpp
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index d8399717fe353908a5e364047b64a4cd08362b62..e3451cde77fc12a3ce5700a755a841af5a88db29 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -91,32 +91,10 @@ private:
};
#endif
-class AutoCheckNoSetContext {
-public:
- AutoCheckNoSetContext(const SkPaint& paint) : fPaint(paint) {
- this->assertNoSetContext(fPaint);
- }
- ~AutoCheckNoSetContext() {
- this->assertNoSetContext(fPaint);
- }
-
-private:
- const SkPaint& fPaint;
-
- void assertNoSetContext(const SkPaint& paint) {
- SkShader* s = paint.getShader();
- if (s) {
- SkASSERT(!s->setContextHasBeenCalled());
- }
- }
-};
-
#define CHECK_LOCKCOUNT_BALANCE(bitmap) AutoCheckLockCountBalance clcb(bitmap)
-#define CHECK_SHADER_NOSETCONTEXT(paint) AutoCheckNoSetContext cshsc(paint)
#else
#define CHECK_LOCKCOUNT_BALANCE(bitmap)
- #define CHECK_SHADER_NOSETCONTEXT(paint)
#endif
typedef SkTLazy<SkPaint> SkLazyPaint;
@@ -1940,8 +1918,6 @@ void SkCanvas::drawPaint(const SkPaint& paint) {
}
void SkCanvas::internalDrawPaint(const SkPaint& paint) {
- CHECK_SHADER_NOSETCONTEXT(paint);
-
LOOPER_BEGIN(paint, SkDrawFilter::kPaint_Type, NULL)
while (iter.next()) {
@@ -1957,8 +1933,6 @@ void SkCanvas::drawPoints(PointMode mode, size_t count, const SkPoint pts[],
return;
}
- CHECK_SHADER_NOSETCONTEXT(paint);
-
SkRect r, storage;
const SkRect* bounds = NULL;
if (paint.canComputeFastBounds()) {
@@ -1986,8 +1960,6 @@ void SkCanvas::drawPoints(PointMode mode, size_t count, const SkPoint pts[],
}
void SkCanvas::drawRect(const SkRect& r, const SkPaint& paint) {
- CHECK_SHADER_NOSETCONTEXT(paint);
-
SkRect storage;
const SkRect* bounds = NULL;
if (paint.canComputeFastBounds()) {
@@ -2007,8 +1979,6 @@ void SkCanvas::drawRect(const SkRect& r, const SkPaint& paint) {
}
void SkCanvas::drawOval(const SkRect& oval, const SkPaint& paint) {
- CHECK_SHADER_NOSETCONTEXT(paint);
-
SkRect storage;
const SkRect* bounds = NULL;
if (paint.canComputeFastBounds()) {
@@ -2028,8 +1998,6 @@ void SkCanvas::drawOval(const SkRect& oval, const SkPaint& paint) {
}
void SkCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
- CHECK_SHADER_NOSETCONTEXT(paint);
-
SkRect storage;
const SkRect* bounds = NULL;
if (paint.canComputeFastBounds()) {
@@ -2060,8 +2028,6 @@ void SkCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
void SkCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner,
const SkPaint& paint) {
- CHECK_SHADER_NOSETCONTEXT(paint);
-
SkRect storage;
const SkRect* bounds = NULL;
if (paint.canComputeFastBounds()) {
@@ -2081,8 +2047,6 @@ void SkCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner,
}
void SkCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
- CHECK_SHADER_NOSETCONTEXT(paint);
-
if (!path.isFinite()) {
return;
}
@@ -2358,8 +2322,6 @@ void SkCanvas::DrawTextDecorations(const SkDraw& draw, const SkPaint& paint,
void SkCanvas::onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y,
const SkPaint& paint) {
- CHECK_SHADER_NOSETCONTEXT(paint);
-
LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, NULL)
while (iter.next()) {
@@ -2374,10 +2336,8 @@ void SkCanvas::onDrawText(const void* text, size_t byteLength, SkScalar x, SkSca
void SkCanvas::onDrawPosText(const void* text, size_t byteLength, const SkPoint pos[],
const SkPaint& paint) {
- CHECK_SHADER_NOSETCONTEXT(paint);
-
LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, NULL)
-
+
while (iter.next()) {
SkDeviceFilteredPaint dfp(iter.fDevice, looper.paint());
iter.fDevice->drawPosText(iter, text, byteLength, &pos->fX, 0, 2,
@@ -2389,10 +2349,8 @@ void SkCanvas::onDrawPosText(const void* text, size_t byteLength, const SkPoint
void SkCanvas::onDrawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[],
SkScalar constY, const SkPaint& paint) {
- CHECK_SHADER_NOSETCONTEXT(paint);
-
LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, NULL)
-
+
while (iter.next()) {
SkDeviceFilteredPaint dfp(iter.fDevice, looper.paint());
iter.fDevice->drawPosText(iter, text, byteLength, xpos, constY, 1,
@@ -2404,10 +2362,8 @@ void SkCanvas::onDrawPosTextH(const void* text, size_t byteLength, const SkScala
void SkCanvas::onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& path,
const SkMatrix* matrix, const SkPaint& paint) {
- CHECK_SHADER_NOSETCONTEXT(paint);
-
LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, NULL)
-
+
while (iter.next()) {
iter.fDevice->drawTextOnPath(iter, text, byteLength, path,
matrix, looper.paint());
@@ -2439,8 +2395,6 @@ void SkCanvas::drawVertices(VertexMode vmode, int vertexCount,
const SkColor colors[], SkXfermode* xmode,
const uint16_t indices[], int indexCount,
const SkPaint& paint) {
- CHECK_SHADER_NOSETCONTEXT(paint);
-
LOOPER_BEGIN(paint, SkDrawFilter::kPath_Type, NULL)
while (iter.next()) {
« no previous file with comments | « src/core/SkBlitter_RGB16.cpp ('k') | src/core/SkComposeShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698