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

Side by Side Diff: src/core/SkCanvas.cpp

Issue 973973003: Text blob run paints should be filtered. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: fix iterator filter skipping Created 5 years, 9 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 unified diff | Download patch
« no previous file with comments | « include/core/SkDevice.h ('k') | src/core/SkDevice.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2008 The Android Open Source Project 2 * Copyright 2008 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkCanvasPriv.h" 9 #include "SkCanvasPriv.h"
10 #include "SkBitmapDevice.h" 10 #include "SkBitmapDevice.h"
(...skipping 2143 matching lines...) Expand 10 before | Expand all | Expand 10 after
2154 const SkPaint& paint) { 2154 const SkPaint& paint) {
2155 2155
2156 if (paint.canComputeFastBounds()) { 2156 if (paint.canComputeFastBounds()) {
2157 SkRect storage; 2157 SkRect storage;
2158 2158
2159 if (this->quickReject(paint.computeFastBounds(blob->bounds().makeOffset( x, y), &storage))) { 2159 if (this->quickReject(paint.computeFastBounds(blob->bounds().makeOffset( x, y), &storage))) {
2160 return; 2160 return;
2161 } 2161 }
2162 } 2162 }
2163 2163
2164 // We cannot filter in the looper as we normally do, because the paint is
2165 // incomplete at this point (text-related attributes are embedded within blo b run paints).
2166 SkDrawFilter* drawFilter = fMCRec->fFilter;
2167 fMCRec->fFilter = NULL;
2168
2164 LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, NULL) 2169 LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, NULL)
2165 2170
2166 while (iter.next()) { 2171 while (iter.next()) {
2167 SkDeviceFilteredPaint dfp(iter.fDevice, looper.paint()); 2172 SkDeviceFilteredPaint dfp(iter.fDevice, looper.paint());
2168 iter.fDevice->drawTextBlob(iter, blob, x, y, dfp.paint()); 2173 iter.fDevice->drawTextBlob(iter, blob, x, y, dfp.paint(), drawFilter);
2169 } 2174 }
2170 2175
2171 LOOPER_END 2176 LOOPER_END
2177
2178 fMCRec->fFilter = drawFilter;
2172 } 2179 }
2173 2180
2174 // These will become non-virtual, so they always call the (virtual) onDraw... me thod 2181 // These will become non-virtual, so they always call the (virtual) onDraw... me thod
2175 void SkCanvas::drawText(const void* text, size_t byteLength, SkScalar x, SkScala r y, 2182 void SkCanvas::drawText(const void* text, size_t byteLength, SkScalar x, SkScala r y,
2176 const SkPaint& paint) { 2183 const SkPaint& paint) {
2177 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawText()"); 2184 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawText()");
2178 this->onDrawText(text, byteLength, x, y, paint); 2185 this->onDrawText(text, byteLength, x, y, paint);
2179 } 2186 }
2180 void SkCanvas::drawPosText(const void* text, size_t byteLength, const SkPoint po s[], 2187 void SkCanvas::drawPosText(const void* text, size_t byteLength, const SkPoint po s[],
2181 const SkPaint& paint) { 2188 const SkPaint& paint) {
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
2513 } 2520 }
2514 2521
2515 if (matrix) { 2522 if (matrix) {
2516 canvas->concat(*matrix); 2523 canvas->concat(*matrix);
2517 } 2524 }
2518 } 2525 }
2519 2526
2520 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { 2527 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() {
2521 fCanvas->restoreToCount(fSaveCount); 2528 fCanvas->restoreToCount(fSaveCount);
2522 } 2529 }
OLDNEW
« no previous file with comments | « include/core/SkDevice.h ('k') | src/core/SkDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698