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

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

Issue 988413003: Change device creation to see the (optional) layer-paint (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: address comments 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
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" 9 #include "SkDeviceProperties.h"
10 #include "SkDraw.h" 10 #include "SkDraw.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 const SkBitmap& SkBaseDevice::accessBitmap(bool changePixels) { 58 const SkBitmap& SkBaseDevice::accessBitmap(bool changePixels) {
59 const SkBitmap& bitmap = this->onAccessBitmap(); 59 const SkBitmap& bitmap = this->onAccessBitmap();
60 if (changePixels) { 60 if (changePixels) {
61 bitmap.notifyPixelsChanged(); 61 bitmap.notifyPixelsChanged();
62 } 62 }
63 return bitmap; 63 return bitmap;
64 } 64 }
65 65
66 SkPixelGeometry SkBaseDevice::CreateInfo::AdjustGeometry(const SkImageInfo& info , 66 SkPixelGeometry SkBaseDevice::CreateInfo::AdjustGeometry(const SkImageInfo& info ,
67 Usage usage, 67 TileUsage tileUsage,
68 SkPixelGeometry geo) { 68 SkPixelGeometry geo) {
69 switch (usage) { 69 switch (tileUsage) {
70 case kGeneral_Usage: 70 case kPossible_TileUsage:
71 break; 71 break;
72 case kSaveLayer_Usage: 72 case kNever_TileUsage:
73 if (info.alphaType() != kOpaque_SkAlphaType) { 73 if (info.alphaType() != kOpaque_SkAlphaType) {
74 geo = kUnknown_SkPixelGeometry; 74 geo = kUnknown_SkPixelGeometry;
75 } 75 }
76 break; 76 break;
77 case kImageFilter_Usage:
78 geo = kUnknown_SkPixelGeometry;
79 break;
80 } 77 }
81 return geo; 78 return geo;
82 } 79 }
83 80
84 void SkBaseDevice::initForRootLayer(SkPixelGeometry geo) { 81 void SkBaseDevice::initForRootLayer(SkPixelGeometry geo) {
85 // For now we don't expect to change the geometry for the root-layer, but we make the call 82 // For now we don't expect to change the geometry for the root-layer, but we make the call
86 // anyway to document logically what is going on. 83 // anyway to document logically what is going on.
87 // 84 //
88 fLeakyProperties->setPixelGeometry(CreateInfo::AdjustGeometry(this->imageInf o(), 85 fLeakyProperties->setPixelGeometry(CreateInfo::AdjustGeometry(this->imageInf o(),
89 kGeneral_Usage , 86 kPossible_Tile Usage,
90 geo)); 87 geo));
91 } 88 }
92 89
93 SkSurface* SkBaseDevice::newSurface(const SkImageInfo&, const SkSurfaceProps&) { return NULL; } 90 SkSurface* SkBaseDevice::newSurface(const SkImageInfo&, const SkSurfaceProps&) { return NULL; }
94 91
95 const void* SkBaseDevice::peekPixels(SkImageInfo*, size_t*) { return NULL; } 92 const void* SkBaseDevice::peekPixels(SkImageInfo*, size_t*) { return NULL; }
96 93
97 void SkBaseDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer, 94 void SkBaseDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer,
98 const SkRRect& inner, const SkPaint& paint) { 95 const SkRRect& inner, const SkPaint& paint) {
99 SkPath path; 96 SkPath path;
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 if (kUnknown_SkPixelGeometry == fLeakyProperties->pixelGeometry() 356 if (kUnknown_SkPixelGeometry == fLeakyProperties->pixelGeometry()
360 || this->onShouldDisableLCD(paint)) { 357 || this->onShouldDisableLCD(paint)) {
361 358
362 flags &= ~SkPaint::kLCDRenderText_Flag; 359 flags &= ~SkPaint::kLCDRenderText_Flag;
363 flags |= SkPaint::kGenA8FromLCD_Flag; 360 flags |= SkPaint::kGenA8FromLCD_Flag;
364 } 361 }
365 362
366 return flags; 363 return flags;
367 } 364 }
368 365
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698