OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
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 "SkDevice.h" | 8 #include "SkDevice.h" |
9 #include "SkDraw.h" | 9 #include "SkDraw.h" |
10 #include "SkDrawFilter.h" | 10 #include "SkDrawFilter.h" |
11 #include "SkImage_Base.h" | 11 #include "SkImage_Base.h" |
12 #include "SkMetaData.h" | 12 #include "SkMetaData.h" |
13 #include "SkPatchUtils.h" | 13 #include "SkPatchUtils.h" |
14 #include "SkPathMeasure.h" | 14 #include "SkPathMeasure.h" |
15 #include "SkRasterClip.h" | 15 #include "SkRasterClip.h" |
16 #include "SkShader.h" | 16 #include "SkShader.h" |
17 #include "SkTextBlob.h" | 17 #include "SkTextBlob.h" |
18 #include "SkTextToPathIter.h" | 18 #include "SkTextToPathIter.h" |
19 | 19 |
20 SkBaseDevice::SkBaseDevice() | 20 SkBaseDevice::SkBaseDevice() |
21 : fLeakyProperties(SkSurfaceProps::kLegacyFontHost_InitType) | 21 : fSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType) |
22 #ifdef SK_DEBUG | 22 #ifdef SK_DEBUG |
23 , fAttachedToCanvas(false) | 23 , fAttachedToCanvas(false) |
24 #endif | 24 #endif |
25 { | 25 { |
26 fOrigin.setZero(); | 26 fOrigin.setZero(); |
27 fMetaData = NULL; | 27 fMetaData = NULL; |
28 } | 28 } |
29 | 29 |
30 SkBaseDevice::SkBaseDevice(const SkSurfaceProps& surfaceProps) | 30 SkBaseDevice::SkBaseDevice(const SkSurfaceProps& surfaceProps) |
31 : fLeakyProperties(surfaceProps) | 31 : fSurfaceProps(surfaceProps) |
32 #ifdef SK_DEBUG | 32 #ifdef SK_DEBUG |
33 , fAttachedToCanvas(false) | 33 , fAttachedToCanvas(false) |
34 #endif | 34 #endif |
35 { | 35 { |
36 fOrigin.setZero(); | 36 fOrigin.setZero(); |
37 fMetaData = NULL; | 37 fMetaData = NULL; |
38 } | 38 } |
39 | 39 |
40 SkBaseDevice::~SkBaseDevice() { | 40 SkBaseDevice::~SkBaseDevice() { |
41 SkDELETE(fMetaData); | 41 SkDELETE(fMetaData); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 } | 77 } |
78 break; | 78 break; |
79 } | 79 } |
80 return geo; | 80 return geo; |
81 } | 81 } |
82 | 82 |
83 void SkBaseDevice::initForRootLayer(SkPixelGeometry geo) { | 83 void SkBaseDevice::initForRootLayer(SkPixelGeometry geo) { |
84 // For now we don't expect to change the geometry for the root-layer, but we
make the call | 84 // For now we don't expect to change the geometry for the root-layer, but we
make the call |
85 // anyway to document logically what is going on. | 85 // anyway to document logically what is going on. |
86 // | 86 // |
87 fLeakyProperties.setPixelGeometry_dont_use(CreateInfo::AdjustGeometry(this->
imageInfo(), | 87 fSurfaceProps.setPixelGeometry_dont_use(CreateInfo::AdjustGeometry(this->ima
geInfo(), |
88 kPossi
ble_TileUsage, | 88 kPossible
_TileUsage, |
89 geo)); | 89 geo)); |
90 } | 90 } |
91 | 91 |
92 void SkBaseDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer, | 92 void SkBaseDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer, |
93 const SkRRect& inner, const SkPaint& paint) { | 93 const SkRRect& inner, const SkPaint& paint) { |
94 SkPath path; | 94 SkPath path; |
95 path.addRRect(outer); | 95 path.addRRect(outer); |
96 path.addRRect(inner); | 96 path.addRRect(inner); |
97 path.setFillType(SkPath::kEvenOdd_FillType); | 97 path.setFillType(SkPath::kEvenOdd_FillType); |
98 | 98 |
99 const SkMatrix* preMatrix = NULL; | 99 const SkMatrix* preMatrix = NULL; |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 | 362 |
363 ////////////////////////////////////////////////////////////////////////////////
////////// | 363 ////////////////////////////////////////////////////////////////////////////////
////////// |
364 | 364 |
365 uint32_t SkBaseDevice::filterTextFlags(const SkPaint& paint) const { | 365 uint32_t SkBaseDevice::filterTextFlags(const SkPaint& paint) const { |
366 uint32_t flags = paint.getFlags(); | 366 uint32_t flags = paint.getFlags(); |
367 | 367 |
368 if (!paint.isLCDRenderText() || !paint.isAntiAlias()) { | 368 if (!paint.isLCDRenderText() || !paint.isAntiAlias()) { |
369 return flags; | 369 return flags; |
370 } | 370 } |
371 | 371 |
372 if (kUnknown_SkPixelGeometry == fLeakyProperties.pixelGeometry() | 372 if (kUnknown_SkPixelGeometry == fSurfaceProps.pixelGeometry() |
373 || this->onShouldDisableLCD(paint)) { | 373 || this->onShouldDisableLCD(paint)) { |
374 | 374 |
375 flags &= ~SkPaint::kLCDRenderText_Flag; | 375 flags &= ~SkPaint::kLCDRenderText_Flag; |
376 flags |= SkPaint::kGenA8FromLCD_Flag; | 376 flags |= SkPaint::kGenA8FromLCD_Flag; |
377 } | 377 } |
378 | 378 |
379 return flags; | 379 return flags; |
380 } | 380 } |
381 | 381 |
OLD | NEW |