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

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

Issue 1196683003: remove SkDeviceProperties (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Clean up Created 5 years, 6 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
OLDNEW
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 "SkDeviceProperties.h"
10 #include "SkDraw.h" 9 #include "SkDraw.h"
11 #include "SkDrawFilter.h" 10 #include "SkDrawFilter.h"
12 #include "SkImage_Base.h" 11 #include "SkImage_Base.h"
13 #include "SkMetaData.h" 12 #include "SkMetaData.h"
14 #include "SkPatchUtils.h" 13 #include "SkPatchUtils.h"
15 #include "SkPathMeasure.h" 14 #include "SkPathMeasure.h"
16 #include "SkRasterClip.h" 15 #include "SkRasterClip.h"
17 #include "SkShader.h" 16 #include "SkShader.h"
18 #include "SkTextBlob.h" 17 #include "SkTextBlob.h"
19 #include "SkTextToPathIter.h" 18 #include "SkTextToPathIter.h"
20 19
21 SkBaseDevice::SkBaseDevice() 20 SkBaseDevice::SkBaseDevice()
22 : fLeakyProperties(SkNEW(SkDeviceProperties)) 21 : fLeakyProperties(SkSurfaceProps::kLegacyFontHost_InitType)
23 #ifdef SK_DEBUG 22 #ifdef SK_DEBUG
24 , fAttachedToCanvas(false) 23 , fAttachedToCanvas(false)
25 #endif 24 #endif
26 { 25 {
27 fOrigin.setZero(); 26 fOrigin.setZero();
28 fMetaData = NULL; 27 fMetaData = NULL;
29 } 28 }
30 29
31 SkBaseDevice::SkBaseDevice(const SkDeviceProperties& dp) 30 SkBaseDevice::SkBaseDevice(const SkSurfaceProps& surfaceProps)
32 : fLeakyProperties(SkNEW_ARGS(SkDeviceProperties, (dp))) 31 : fLeakyProperties(surfaceProps)
33 #ifdef SK_DEBUG 32 #ifdef SK_DEBUG
34 , fAttachedToCanvas(false) 33 , fAttachedToCanvas(false)
35 #endif 34 #endif
36 { 35 {
37 fOrigin.setZero(); 36 fOrigin.setZero();
38 fMetaData = NULL; 37 fMetaData = NULL;
39 } 38 }
40 39
41 SkBaseDevice::~SkBaseDevice() { 40 SkBaseDevice::~SkBaseDevice() {
42 SkDELETE(fLeakyProperties);
43 SkDELETE(fMetaData); 41 SkDELETE(fMetaData);
44 } 42 }
45 43
46 SkMetaData& SkBaseDevice::getMetaData() { 44 SkMetaData& SkBaseDevice::getMetaData() {
47 // metadata users are rare, so we lazily allocate it. If that changes we 45 // metadata users are rare, so we lazily allocate it. If that changes we
48 // can decide to just make it a field in the device (rather than a ptr) 46 // can decide to just make it a field in the device (rather than a ptr)
49 if (NULL == fMetaData) { 47 if (NULL == fMetaData) {
50 fMetaData = new SkMetaData; 48 fMetaData = new SkMetaData;
51 } 49 }
52 return *fMetaData; 50 return *fMetaData;
(...skipping 26 matching lines...) Expand all
79 } 77 }
80 break; 78 break;
81 } 79 }
82 return geo; 80 return geo;
83 } 81 }
84 82
85 void SkBaseDevice::initForRootLayer(SkPixelGeometry geo) { 83 void SkBaseDevice::initForRootLayer(SkPixelGeometry geo) {
86 // 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
87 // anyway to document logically what is going on. 85 // anyway to document logically what is going on.
88 // 86 //
89 fLeakyProperties->setPixelGeometry(CreateInfo::AdjustGeometry(this->imageInf o(), 87 fLeakyProperties.setPixelGeometry_dont_use(CreateInfo::AdjustGeometry(this-> imageInfo(),
90 kPossible_Tile Usage, 88 kPossi ble_TileUsage,
91 geo)); 89 geo));
92 } 90 }
93 91
94 void SkBaseDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer, 92 void SkBaseDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer,
95 const SkRRect& inner, const SkPaint& paint) { 93 const SkRRect& inner, const SkPaint& paint) {
96 SkPath path; 94 SkPath path;
97 path.addRRect(outer); 95 path.addRRect(outer);
98 path.addRRect(inner); 96 path.addRRect(inner);
99 path.setFillType(SkPath::kEvenOdd_FillType); 97 path.setFillType(SkPath::kEvenOdd_FillType);
100 98
101 const SkMatrix* preMatrix = NULL; 99 const SkMatrix* preMatrix = NULL;
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 362
365 //////////////////////////////////////////////////////////////////////////////// ////////// 363 //////////////////////////////////////////////////////////////////////////////// //////////
366 364
367 uint32_t SkBaseDevice::filterTextFlags(const SkPaint& paint) const { 365 uint32_t SkBaseDevice::filterTextFlags(const SkPaint& paint) const {
368 uint32_t flags = paint.getFlags(); 366 uint32_t flags = paint.getFlags();
369 367
370 if (!paint.isLCDRenderText() || !paint.isAntiAlias()) { 368 if (!paint.isLCDRenderText() || !paint.isAntiAlias()) {
371 return flags; 369 return flags;
372 } 370 }
373 371
374 if (kUnknown_SkPixelGeometry == fLeakyProperties->pixelGeometry() 372 if (kUnknown_SkPixelGeometry == fLeakyProperties.pixelGeometry()
375 || this->onShouldDisableLCD(paint)) { 373 || this->onShouldDisableLCD(paint)) {
376 374
377 flags &= ~SkPaint::kLCDRenderText_Flag; 375 flags &= ~SkPaint::kLCDRenderText_Flag;
378 flags |= SkPaint::kGenA8FromLCD_Flag; 376 flags |= SkPaint::kGenA8FromLCD_Flag;
379 } 377 }
380 378
381 return flags; 379 return flags;
382 } 380 }
383 381
OLDNEW
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | src/core/SkDeviceProperties.h » ('j') | src/gpu/SkGpuDevice.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698