Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 | 8 |
| 9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkCanvasPriv.h" | 10 #include "SkCanvasPriv.h" |
| 11 #include "SkBitmapDevice.h" | 11 #include "SkBitmapDevice.h" |
| 12 #include "SkDeviceImageFilterProxy.h" | 12 #include "SkDeviceImageFilterProxy.h" |
| 13 #include "SkDraw.h" | 13 #include "SkDraw.h" |
| 14 #include "SkDrawFilter.h" | 14 #include "SkDrawFilter.h" |
| 15 #include "SkDrawLooper.h" | 15 #include "SkDrawLooper.h" |
| 16 #include "SkMetaData.h" | 16 #include "SkMetaData.h" |
| 17 #include "SkPathOps.h" | 17 #include "SkPathOps.h" |
| 18 #include "SkPatchUtils.h" | 18 #include "SkPatchUtils.h" |
| 19 #include "SkPicture.h" | 19 #include "SkPicture.h" |
| 20 #include "SkRasterClip.h" | 20 #include "SkRasterClip.h" |
| 21 #include "SkRRect.h" | 21 #include "SkRRect.h" |
| 22 #include "SkSmallAllocator.h" | 22 #include "SkSmallAllocator.h" |
| 23 #include "SkSurface_Base.h" | 23 #include "SkSurface_Base.h" |
| 24 #include "SkTemplates.h" | 24 #include "SkTemplates.h" |
| 25 #include "SkTextBlob.h" | |
| 25 #include "SkTextFormatParams.h" | 26 #include "SkTextFormatParams.h" |
| 26 #include "SkTLazy.h" | 27 #include "SkTLazy.h" |
| 27 #include "SkUtils.h" | 28 #include "SkUtils.h" |
| 28 | 29 |
| 29 #if SK_SUPPORT_GPU | 30 #if SK_SUPPORT_GPU |
| 30 #include "GrRenderTarget.h" | 31 #include "GrRenderTarget.h" |
| 31 #endif | 32 #endif |
| 32 | 33 |
| 33 // experimental for faster tiled drawing... | 34 // experimental for faster tiled drawing... |
| 34 //#define SK_ENABLE_CLIP_QUICKREJECT | 35 //#define SK_ENABLE_CLIP_QUICKREJECT |
| (...skipping 2175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2210 while (iter.next()) { | 2211 while (iter.next()) { |
| 2211 iter.fDevice->drawTextOnPath(iter, text, byteLength, path, | 2212 iter.fDevice->drawTextOnPath(iter, text, byteLength, path, |
| 2212 matrix, looper.paint()); | 2213 matrix, looper.paint()); |
| 2213 } | 2214 } |
| 2214 | 2215 |
| 2215 LOOPER_END | 2216 LOOPER_END |
| 2216 } | 2217 } |
| 2217 | 2218 |
| 2218 void SkCanvas::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, | 2219 void SkCanvas::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, |
| 2219 const SkPaint& paint) { | 2220 const SkPaint& paint) { |
| 2221 | |
| 2222 // FIXME: temporarily disable quickreject for empty bounds, | |
| 2223 // pending implicit blob bounds implementation. | |
| 2224 if (!blob->bounds().isEmpty() && paint.canComputeFastBounds()) { | |
| 2225 SkRect storage; | |
| 2226 const SkRect *bounds = &blob->bounds(); | |
|
reed1
2014/08/29 16:22:56
Do we need local "bounds" or the if (x || y)?
com
f(malita)
2014/08/29 16:32:01
Only if we want to avoid initializing a "translate
| |
| 2227 | |
| 2228 if (x || y) { | |
| 2229 storage = bounds->makeOffset(x, y); | |
| 2230 bounds = &storage; | |
| 2231 } | |
| 2232 | |
| 2233 if (this->quickReject(paint.computeFastBounds(*bounds, &storage))) { | |
| 2234 return; | |
| 2235 } | |
| 2236 } | |
| 2237 | |
| 2220 LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, NULL) | 2238 LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, NULL) |
| 2221 | 2239 |
| 2222 while (iter.next()) { | 2240 while (iter.next()) { |
| 2223 SkDeviceFilteredPaint dfp(iter.fDevice, looper.paint()); | 2241 SkDeviceFilteredPaint dfp(iter.fDevice, looper.paint()); |
| 2224 iter.fDevice->drawTextBlob(iter, blob, x, y, dfp.paint()); | 2242 iter.fDevice->drawTextBlob(iter, blob, x, y, dfp.paint()); |
| 2225 } | 2243 } |
| 2226 | 2244 |
| 2227 LOOPER_END | 2245 LOOPER_END |
| 2228 } | 2246 } |
| 2229 | 2247 |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2564 } | 2582 } |
| 2565 | 2583 |
| 2566 if (NULL != matrix) { | 2584 if (NULL != matrix) { |
| 2567 canvas->concat(*matrix); | 2585 canvas->concat(*matrix); |
| 2568 } | 2586 } |
| 2569 } | 2587 } |
| 2570 | 2588 |
| 2571 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { | 2589 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { |
| 2572 fCanvas->restoreToCount(fSaveCount); | 2590 fCanvas->restoreToCount(fSaveCount); |
| 2573 } | 2591 } |
| OLD | NEW |