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 #include "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkCanvasDrawable.h" | 9 #include "SkCanvasDrawable.h" |
10 #include "SkCanvasPriv.h" | 10 #include "SkCanvasPriv.h" |
(...skipping 2037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2048 TRACE_EVENT0("skia", "SkCanvas::drawBitmapNine()"); | 2048 TRACE_EVENT0("skia", "SkCanvas::drawBitmapNine()"); |
2049 SkDEBUGCODE(bitmap.validate();) | 2049 SkDEBUGCODE(bitmap.validate();) |
2050 | 2050 |
2051 // Need a device entry-point, so gpu can use a mesh | 2051 // Need a device entry-point, so gpu can use a mesh |
2052 this->internalDrawBitmapNine(bitmap, center, dst, paint); | 2052 this->internalDrawBitmapNine(bitmap, center, dst, paint); |
2053 } | 2053 } |
2054 | 2054 |
2055 class SkDeviceFilteredPaint { | 2055 class SkDeviceFilteredPaint { |
2056 public: | 2056 public: |
2057 SkDeviceFilteredPaint(SkBaseDevice* device, const SkPaint& paint) { | 2057 SkDeviceFilteredPaint(SkBaseDevice* device, const SkPaint& paint) { |
2058 if (device->shouldDisableLCD(paint)) { | 2058 uint32_t filteredFlags = device->filterTextFlags(paint); |
2059 uint32_t flags = paint.getFlags(); | 2059 if (filteredFlags != paint.getFlags()) { |
2060 flags &= ~SkPaint::kLCDRenderText_Flag; | |
2061 flags |= SkPaint::kGenA8FromLCD_Flag; | |
2062 SkPaint* newPaint = fLazy.set(paint); | 2060 SkPaint* newPaint = fLazy.set(paint); |
2063 newPaint->setFlags(flags); | 2061 newPaint->setFlags(filteredFlags); |
2064 fPaint = newPaint; | 2062 fPaint = newPaint; |
2065 } else { | 2063 } else { |
2066 fPaint = &paint; | 2064 fPaint = &paint; |
2067 } | 2065 } |
2068 } | 2066 } |
2069 | 2067 |
2070 const SkPaint& paint() const { return *fPaint; } | 2068 const SkPaint& paint() const { return *fPaint; } |
2071 | 2069 |
2072 private: | 2070 private: |
2073 const SkPaint* fPaint; | 2071 const SkPaint* fPaint; |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2586 } | 2584 } |
2587 | 2585 |
2588 if (matrix) { | 2586 if (matrix) { |
2589 canvas->concat(*matrix); | 2587 canvas->concat(*matrix); |
2590 } | 2588 } |
2591 } | 2589 } |
2592 | 2590 |
2593 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { | 2591 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { |
2594 fCanvas->restoreToCount(fSaveCount); | 2592 fCanvas->restoreToCount(fSaveCount); |
2595 } | 2593 } |
OLD | NEW |