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

Side by Side Diff: tools/android/SkBitmapRegionCodec.cpp

Issue 1442553003: Lock pixels again after dummy reset of pixel ref in SkBitmapRegionCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month 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 | « no previous file | no next file » | 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 2015 Google Inc. 2 * Copyright 2015 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 "SkAndroidCodec.h" 8 #include "SkAndroidCodec.h"
9 #include "SkBitmapRegionCodec.h" 9 #include "SkBitmapRegionCodec.h"
10 #include "SkBitmapRegionDecoderPriv.h" 10 #include "SkBitmapRegionDecoderPriv.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 options.fZeroInitialized = zeroInit; 122 options.fZeroInitialized = zeroInit;
123 void* dst = bitmap->getAddr(scaledOutX, scaledOutY); 123 void* dst = bitmap->getAddr(scaledOutX, scaledOutY);
124 124
125 // FIXME: skbug.com/4538 125 // FIXME: skbug.com/4538
126 // It is important that we use the rowBytes on the pixelRef. They may not b e 126 // It is important that we use the rowBytes on the pixelRef. They may not b e
127 // set properly on the bitmap. 127 // set properly on the bitmap.
128 SkPixelRef* pr = SkRef(bitmap->pixelRef()); 128 SkPixelRef* pr = SkRef(bitmap->pixelRef());
129 size_t rowBytes = pr->rowBytes(); 129 size_t rowBytes = pr->rowBytes();
130 bitmap->setInfo(outInfo, rowBytes); 130 bitmap->setInfo(outInfo, rowBytes);
131 bitmap->setPixelRef(pr)->unref(); 131 bitmap->setPixelRef(pr)->unref();
132 bitmap->lockPixels();
132 SkCodec::Result result = fCodec->getAndroidPixels(decodeInfo, dst, rowBytes, &options); 133 SkCodec::Result result = fCodec->getAndroidPixels(decodeInfo, dst, rowBytes, &options);
133 if (SkCodec::kSuccess != result && SkCodec::kIncompleteInput != result) { 134 if (SkCodec::kSuccess != result && SkCodec::kIncompleteInput != result) {
134 SkCodecPrintf("Error: Could not get pixels.\n"); 135 SkCodecPrintf("Error: Could not get pixels.\n");
135 return false; 136 return false;
136 } 137 }
137 138
138 return true; 139 return true;
139 } 140 }
140 141
141 bool SkBitmapRegionCodec::conversionSupported(SkColorType colorType) { 142 bool SkBitmapRegionCodec::conversionSupported(SkColorType colorType) {
142 // FIXME: Call virtual function when it lands. 143 // FIXME: Call virtual function when it lands.
143 SkImageInfo info = SkImageInfo::Make(0, 0, colorType, fCodec->getInfo().alph aType(), 144 SkImageInfo info = SkImageInfo::Make(0, 0, colorType, fCodec->getInfo().alph aType(),
144 fCodec->getInfo().profileType()); 145 fCodec->getInfo().profileType());
145 return conversion_possible(info, fCodec->getInfo()); 146 return conversion_possible(info, fCodec->getInfo());
146 } 147 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698