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

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

Issue 2309483002: WIP RasterCanvasLayerAllocator experiment 2
Patch Set: vend smart pointers to SkCanvas Created 4 years, 2 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
« no previous file with comments | « include/core/SkRasterCanvasLayerAllocator.h ('k') | src/core/SkCanvas.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 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 "SkBitmapDevice.h" 8 #include "SkBitmapDevice.h"
9 #include "SkConfig8888.h" 9 #include "SkConfig8888.h"
10 #include "SkDraw.h" 10 #include "SkDraw.h"
11 #include "SkImageFilter.h" 11 #include "SkImageFilter.h"
12 #include "SkImageFilterCache.h" 12 #include "SkImageFilterCache.h"
13 #include "SkMallocPixelRef.h" 13 #include "SkMallocPixelRef.h"
14 #include "SkManagedBitmapDevice.h"
14 #include "SkMatrix.h" 15 #include "SkMatrix.h"
15 #include "SkPaint.h" 16 #include "SkPaint.h"
16 #include "SkPath.h" 17 #include "SkPath.h"
17 #include "SkPixelRef.h" 18 #include "SkPixelRef.h"
18 #include "SkPixmap.h" 19 #include "SkPixmap.h"
20 #include "SkRasterCanvasLayerAllocator.h"
19 #include "SkRasterClip.h" 21 #include "SkRasterClip.h"
20 #include "SkShader.h" 22 #include "SkShader.h"
21 #include "SkSpecialImage.h" 23 #include "SkSpecialImage.h"
22 #include "SkSurface.h" 24 #include "SkSurface.h"
23 #include "SkXfermode.h" 25 #include "SkXfermode.h"
24 26
25 class SkColorTable; 27 class SkColorTable;
26 28
27 static bool valid_for_bitmap_device(const SkImageInfo& info, 29 static bool valid_for_bitmap_device(const SkImageInfo& info,
28 SkAlphaType* newAlphaType) { 30 SkAlphaType* newAlphaType) {
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 } 129 }
128 130
129 void SkBitmapDevice::replaceBitmapBackendForRasterSurface(const SkBitmap& bm) { 131 void SkBitmapDevice::replaceBitmapBackendForRasterSurface(const SkBitmap& bm) {
130 SkASSERT(bm.width() == fBitmap.width()); 132 SkASSERT(bm.width() == fBitmap.width());
131 SkASSERT(bm.height() == fBitmap.height()); 133 SkASSERT(bm.height() == fBitmap.height());
132 fBitmap = bm; // intent is to use bm's pixelRef (and rowbytes/config) 134 fBitmap = bm; // intent is to use bm's pixelRef (and rowbytes/config)
133 fBitmap.lockPixels(); 135 fBitmap.lockPixels();
134 this->privateResize(fBitmap.info().width(), fBitmap.info().height()); 136 this->privateResize(fBitmap.info().width(), fBitmap.info().height());
135 } 137 }
136 138
137 SkBaseDevice* SkBitmapDevice::onCreateDevice(const CreateInfo& cinfo, const SkPa int*) { 139 SkBaseDevice* SkBitmapDevice::onCreateDevice(const CreateInfo& cinfo, const SkPa int*,
140 SkRasterCanvasLayerAllocator* alloc ator) {
138 const SkSurfaceProps surfaceProps(this->surfaceProps().flags(), cinfo.fPixel Geometry); 141 const SkSurfaceProps surfaceProps(this->surfaceProps().flags(), cinfo.fPixel Geometry);
142 if (allocator) {
143 return allocator->makeDevice(cinfo.fInfo, surfaceProps);
144 }
139 return SkBitmapDevice::Create(cinfo.fInfo, surfaceProps); 145 return SkBitmapDevice::Create(cinfo.fInfo, surfaceProps);
140 } 146 }
141 147
142 const SkBitmap& SkBitmapDevice::onAccessBitmap() { 148 const SkBitmap& SkBitmapDevice::onAccessBitmap() {
143 return fBitmap; 149 return fBitmap;
144 } 150 }
145 151
146 bool SkBitmapDevice::onAccessPixels(SkPixmap* pmap) { 152 bool SkBitmapDevice::onAccessPixels(SkPixmap* pmap) {
147 if (this->onPeekPixels(pmap)) { 153 if (this->onPeekPixels(pmap)) {
148 fBitmap.notifyPixelsChanged(); 154 fBitmap.notifyPixelsChanged();
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 paint.getRasterizer() || 450 paint.getRasterizer() ||
445 paint.getPathEffect() || 451 paint.getPathEffect() ||
446 paint.isFakeBoldText() || 452 paint.isFakeBoldText() ||
447 paint.getStyle() != SkPaint::kFill_Style || 453 paint.getStyle() != SkPaint::kFill_Style ||
448 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode)) 454 !SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode))
449 { 455 {
450 return true; 456 return true;
451 } 457 }
452 return false; 458 return false;
453 } 459 }
OLDNEW
« no previous file with comments | « include/core/SkRasterCanvasLayerAllocator.h ('k') | src/core/SkCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698