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

Side by Side Diff: src/images/SkImageRef.cpp

Issue 25275004: store SkAlphaType inside SkBitmap, on road to support unpremul (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "SkImageRef.h" 8 #include "SkImageRef.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkFlattenableBuffers.h" 10 #include "SkFlattenableBuffers.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 return false; 54 return false;
55 } 55 }
56 56
57 SkASSERT(SkBitmap::kNo_Config != fBitmap.config()); 57 SkASSERT(SkBitmap::kNo_Config != fBitmap.config());
58 if (bitmap) { 58 if (bitmap) {
59 bitmap->setConfig(fBitmap.config(), fBitmap.width(), fBitmap.height()); 59 bitmap->setConfig(fBitmap.config(), fBitmap.width(), fBitmap.height());
60 } 60 }
61 return true; 61 return true;
62 } 62 }
63 63
64 bool SkImageRef::isOpaque(SkBitmap* bitmap) { 64 bool SkImageRef::isOpaque(SkBitmap* bitmap) {
scroggo 2013/10/18 19:32:40 Doesn't necessarily need to be fixed here, but loo
65 if (bitmap && bitmap->pixelRef() == this) { 65 if (bitmap && bitmap->pixelRef() == this) {
66 bitmap->lockPixels(); 66 bitmap->lockPixels();
67 bitmap->setIsOpaque(fBitmap.isOpaque()); 67 // what about colortables??????
scroggo 2013/10/18 19:32:40 Didn't you make colortables immutable so that you
68 bitmap->setAlphaType(fBitmap.alphaType());
68 bitmap->unlockPixels(); 69 bitmap->unlockPixels();
69 return true; 70 return true;
70 } 71 }
71 return false; 72 return false;
72 } 73 }
73 74
74 SkImageDecoderFactory* SkImageRef::setDecoderFactory( 75 SkImageDecoderFactory* SkImageRef::setDecoderFactory(
75 SkImageDecoderFactory* fact) { 76 SkImageDecoderFactory* fact) {
76 SkRefCnt_SafeAssign(fFactory, fact); 77 SkRefCnt_SafeAssign(fFactory, fact);
77 return fact; 78 return fact;
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 // now. 193 // now.
193 if (!fStream->rewind()) { 194 if (!fStream->rewind()) {
194 SkDEBUGF(("Failed to rewind SkImageRef stream!")); 195 SkDEBUGF(("Failed to rewind SkImageRef stream!"));
195 buffer.write32(0); 196 buffer.write32(0);
196 } else { 197 } else {
197 // FIXME: Handle getLength properly here. Perhaps this class should 198 // FIXME: Handle getLength properly here. Perhaps this class should
198 // take an SkStreamAsset. 199 // take an SkStreamAsset.
199 buffer.writeStream(fStream, fStream->getLength()); 200 buffer.writeStream(fStream, fStream->getLength());
200 } 201 }
201 } 202 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698