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

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

Issue 302053002: Revert of setConfig -> setInfo (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: 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/SkImagePriv.h ('k') | src/image/SkSurface_Raster.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 "SkImage_Base.h" 8 #include "SkImage_Base.h"
9 #include "SkImagePriv.h" 9 #include "SkImagePriv.h"
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 13 matching lines...) Expand all
24 if (info.fWidth > maxDimension || info.fHeight > maxDimension) { 24 if (info.fWidth > maxDimension || info.fHeight > maxDimension) {
25 return false; 25 return false;
26 } 26 }
27 if ((unsigned)info.fColorType > (unsigned)kLastEnum_SkColorType) { 27 if ((unsigned)info.fColorType > (unsigned)kLastEnum_SkColorType) {
28 return false; 28 return false;
29 } 29 }
30 if ((unsigned)info.fAlphaType > (unsigned)kLastEnum_SkAlphaType) { 30 if ((unsigned)info.fAlphaType > (unsigned)kLastEnum_SkAlphaType) {
31 return false; 31 return false;
32 } 32 }
33 33
34 if (kUnknown_SkColorType == info.colorType()) { 34 if (SkImageInfoToBitmapConfig(info) == SkBitmap::kNo_Config) {
35 return false; 35 return false;
36 } 36 }
37 37
38 // TODO: check colorspace 38 // TODO: check colorspace
39 39
40 if (rowBytes < SkImageMinRowBytes(info)) { 40 if (rowBytes < SkImageMinRowBytes(info)) {
41 return false; 41 return false;
42 } 42 }
43 43
44 int64_t size = (int64_t)info.fHeight * rowBytes; 44 int64_t size = (int64_t)info.fHeight * rowBytes;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 SkColorTable* ctable = NULL; 97 SkColorTable* ctable = NULL;
98 98
99 fBitmap.installPixels(info, addr, rowBytes, ctable, release_data, data); 99 fBitmap.installPixels(info, addr, rowBytes, ctable, release_data, data);
100 fBitmap.setImmutable(); 100 fBitmap.setImmutable();
101 fBitmap.lockPixels(); 101 fBitmap.lockPixels();
102 } 102 }
103 103
104 SkImage_Raster::SkImage_Raster(const Info& info, SkPixelRef* pr, size_t rowBytes ) 104 SkImage_Raster::SkImage_Raster(const Info& info, SkPixelRef* pr, size_t rowBytes )
105 : INHERITED(info.fWidth, info.fHeight) 105 : INHERITED(info.fWidth, info.fHeight)
106 { 106 {
107 fBitmap.setInfo(info, rowBytes); 107 fBitmap.setConfig(info, rowBytes);
108 fBitmap.setPixelRef(pr); 108 fBitmap.setPixelRef(pr);
109 fBitmap.lockPixels(); 109 fBitmap.lockPixels();
110 } 110 }
111 111
112 SkImage_Raster::~SkImage_Raster() {} 112 SkImage_Raster::~SkImage_Raster() {}
113 113
114 void SkImage_Raster::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPa int* paint) { 114 void SkImage_Raster::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPa int* paint) {
115 canvas->drawBitmap(fBitmap, x, y, paint); 115 canvas->drawBitmap(fBitmap, x, y, paint);
116 } 116 }
117 117
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 } 190 }
191 191
192 SkImage* SkNewImageFromPixelRef(const SkImageInfo& info, SkPixelRef* pr, 192 SkImage* SkNewImageFromPixelRef(const SkImageInfo& info, SkPixelRef* pr,
193 size_t rowBytes) { 193 size_t rowBytes) {
194 return SkNEW_ARGS(SkImage_Raster, (info, pr, rowBytes)); 194 return SkNEW_ARGS(SkImage_Raster, (info, pr, rowBytes));
195 } 195 }
196 196
197 SkPixelRef* SkBitmapImageGetPixelRef(SkImage* image) { 197 SkPixelRef* SkBitmapImageGetPixelRef(SkImage* image) {
198 return ((SkImage_Raster*)image)->getPixelRef(); 198 return ((SkImage_Raster*)image)->getPixelRef();
199 } 199 }
OLDNEW
« no previous file with comments | « src/image/SkImagePriv.h ('k') | src/image/SkSurface_Raster.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698