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

Side by Side Diff: src/image/SkSurface_Raster.cpp

Issue 1810813003: update callsites for Make image factories (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: start to take advantage of sk_sp drawImage Created 4 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
« no previous file with comments | « src/image/SkSurface_Gpu.cpp ('k') | src/pdf/SkPDFCanon.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 2012 Google Inc. 2 * Copyright 2012 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 "SkSurface_Base.h" 8 #include "SkSurface_Base.h"
9 #include "SkImagePriv.h" 9 #include "SkImagePriv.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 136
137 void SkSurface_Raster::onRestoreBackingMutability() { 137 void SkSurface_Raster::onRestoreBackingMutability() {
138 SkASSERT(!this->hasCachedImage()); // Shouldn't be any snapshots out there. 138 SkASSERT(!this->hasCachedImage()); // Shouldn't be any snapshots out there.
139 if (SkPixelRef* pr = fBitmap.pixelRef()) { 139 if (SkPixelRef* pr = fBitmap.pixelRef()) {
140 pr->restoreMutability(); 140 pr->restoreMutability();
141 } 141 }
142 } 142 }
143 143
144 void SkSurface_Raster::onCopyOnWrite(ContentChangeMode mode) { 144 void SkSurface_Raster::onCopyOnWrite(ContentChangeMode mode) {
145 // are we sharing pixelrefs with the image? 145 // are we sharing pixelrefs with the image?
146 SkAutoTUnref<SkImage> cached(this->refCachedImage(SkBudgeted::kNo, kNo_Force Unique)); 146 sk_sp<SkImage> cached(this->refCachedImage(SkBudgeted::kNo, kNo_ForceUnique) );
147 SkASSERT(cached); 147 SkASSERT(cached);
148 if (SkBitmapImageGetPixelRef(cached) == fBitmap.pixelRef()) { 148 if (SkBitmapImageGetPixelRef(cached.get()) == fBitmap.pixelRef()) {
149 SkASSERT(fWeOwnThePixels); 149 SkASSERT(fWeOwnThePixels);
150 if (kDiscard_ContentChangeMode == mode) { 150 if (kDiscard_ContentChangeMode == mode) {
151 fBitmap.allocPixels(); 151 fBitmap.allocPixels();
152 } else { 152 } else {
153 SkBitmap prev(fBitmap); 153 SkBitmap prev(fBitmap);
154 fBitmap.allocPixels(); 154 fBitmap.allocPixels();
155 prev.lockPixels(); 155 prev.lockPixels();
156 SkASSERT(prev.info() == fBitmap.info()); 156 SkASSERT(prev.info() == fBitmap.info());
157 SkASSERT(prev.rowBytes() == fBitmap.rowBytes()); 157 SkASSERT(prev.rowBytes() == fBitmap.rowBytes());
158 memcpy(fBitmap.getPixels(), prev.getPixels(), fBitmap.getSafeSize()) ; 158 memcpy(fBitmap.getPixels(), prev.getPixels(), fBitmap.getSafeSize()) ;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 } 202 }
203 if (rowBytes) { 203 if (rowBytes) {
204 SkASSERT(pr->rowBytes() == rowBytes); 204 SkASSERT(pr->rowBytes() == rowBytes);
205 } 205 }
206 return new SkSurface_Raster(pr, props); 206 return new SkSurface_Raster(pr, props);
207 } 207 }
208 208
209 SkSurface* SkSurface::NewRaster(const SkImageInfo& info, const SkSurfaceProps* p rops) { 209 SkSurface* SkSurface::NewRaster(const SkImageInfo& info, const SkSurfaceProps* p rops) {
210 return NewRaster(info, 0, props); 210 return NewRaster(info, 0, props);
211 } 211 }
OLDNEW
« no previous file with comments | « src/image/SkSurface_Gpu.cpp ('k') | src/pdf/SkPDFCanon.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698