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

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

Issue 301283003: Revert "Revert of setConfig -> setInfo (https://codereview.chromium.org/308683005/)" (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: add guard for android Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/image/SkImage_Raster.cpp ('k') | src/images/SkImageDecoder_libwebp.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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 if (size > kMaxTotalSize) { 72 if (size > kMaxTotalSize) {
73 return false; 73 return false;
74 } 74 }
75 75
76 return true; 76 return true;
77 } 77 }
78 78
79 SkSurface_Raster::SkSurface_Raster(const SkImageInfo& info, void* pixels, size_t rb) 79 SkSurface_Raster::SkSurface_Raster(const SkImageInfo& info, void* pixels, size_t rb)
80 : INHERITED(info) 80 : INHERITED(info)
81 { 81 {
82 fBitmap.setConfig(info, rb); 82 fBitmap.installPixels(info, pixels, rb);
83 fBitmap.setPixels(pixels);
84 fWeOwnThePixels = false; // We are "Direct" 83 fWeOwnThePixels = false; // We are "Direct"
85 } 84 }
86 85
87 SkSurface_Raster::SkSurface_Raster(SkPixelRef* pr) 86 SkSurface_Raster::SkSurface_Raster(SkPixelRef* pr)
88 : INHERITED(pr->info().fWidth, pr->info().fHeight) 87 : INHERITED(pr->info().fWidth, pr->info().fHeight)
89 { 88 {
90 const SkImageInfo& info = pr->info(); 89 const SkImageInfo& info = pr->info();
91 90
92 fBitmap.setConfig(info, info.minRowBytes()); 91 fBitmap.setInfo(info, info.minRowBytes());
93 fBitmap.setPixelRef(pr); 92 fBitmap.setPixelRef(pr);
94 fWeOwnThePixels = true; 93 fWeOwnThePixels = true;
95 94
96 if (!info.isOpaque()) { 95 if (!info.isOpaque()) {
97 fBitmap.eraseColor(SK_ColorTRANSPARENT); 96 fBitmap.eraseColor(SK_ColorTRANSPARENT);
98 } 97 }
99 } 98 }
100 99
101 SkCanvas* SkSurface_Raster::onNewCanvas() { 100 SkCanvas* SkSurface_Raster::onNewCanvas() {
102 return SkNEW_ARGS(SkCanvas, (fBitmap)); 101 return SkNEW_ARGS(SkCanvas, (fBitmap));
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 if (!SkSurface_Raster::Valid(info)) { 151 if (!SkSurface_Raster::Valid(info)) {
153 return NULL; 152 return NULL;
154 } 153 }
155 154
156 SkAutoTUnref<SkPixelRef> pr(SkMallocPixelRef::NewAllocate(info, 0, NULL)); 155 SkAutoTUnref<SkPixelRef> pr(SkMallocPixelRef::NewAllocate(info, 0, NULL));
157 if (NULL == pr.get()) { 156 if (NULL == pr.get()) {
158 return NULL; 157 return NULL;
159 } 158 }
160 return SkNEW_ARGS(SkSurface_Raster, (pr)); 159 return SkNEW_ARGS(SkSurface_Raster, (pr));
161 } 160 }
OLDNEW
« no previous file with comments | « src/image/SkImage_Raster.cpp ('k') | src/images/SkImageDecoder_libwebp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698