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

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

Issue 1992143003: Delete workaround for matching bitmap and pixel ref rowbytes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 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 | « 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 108
109 // Decode into the destination bitmap 109 // Decode into the destination bitmap
110 SkAndroidCodec::AndroidOptions options; 110 SkAndroidCodec::AndroidOptions options;
111 options.fSampleSize = sampleSize; 111 options.fSampleSize = sampleSize;
112 options.fSubset = ⊂ 112 options.fSubset = ⊂
113 options.fColorPtr = colors; 113 options.fColorPtr = colors;
114 options.fColorCount = &maxColors; 114 options.fColorCount = &maxColors;
115 options.fZeroInitialized = zeroInit; 115 options.fZeroInitialized = zeroInit;
116 void* dst = bitmap->getAddr(scaledOutX, scaledOutY); 116 void* dst = bitmap->getAddr(scaledOutX, scaledOutY);
117 117
118 // FIXME: skbug.com/4538 118 SkCodec::Result result = fCodec->getAndroidPixels(decodeInfo, dst, bitmap->r owBytes(),
119 // It is important that we use the rowBytes on the pixelRef. They may not b e 119 &options);
120 // set properly on the bitmap.
121 SkPixelRef* pr = SkRef(bitmap->pixelRef());
122 size_t rowBytes = pr->rowBytes();
123 bitmap->setInfo(outInfo, rowBytes);
124 bitmap->setPixelRef(pr)->unref();
125 bitmap->lockPixels();
126 SkCodec::Result result = fCodec->getAndroidPixels(decodeInfo, dst, rowBytes, &options);
127 if (SkCodec::kSuccess != result && SkCodec::kIncompleteInput != result) { 120 if (SkCodec::kSuccess != result && SkCodec::kIncompleteInput != result) {
128 SkCodecPrintf("Error: Could not get pixels.\n"); 121 SkCodecPrintf("Error: Could not get pixels.\n");
129 return false; 122 return false;
130 } 123 }
131 124
132 // Intialize the color table 125 // Intialize the color table
133 if (kIndex_8_SkColorType == dstColorType) { 126 if (kIndex_8_SkColorType == dstColorType) {
134 colorTable->dangerous_overwriteColors(colors, maxColors); 127 colorTable->dangerous_overwriteColors(colors, maxColors);
135 } 128 }
136 129
137 return true; 130 return true;
138 } 131 }
139 132
140 bool SkBitmapRegionCodec::conversionSupported(SkColorType colorType) { 133 bool SkBitmapRegionCodec::conversionSupported(SkColorType colorType) {
141 // FIXME: Call virtual function when it lands. 134 // FIXME: Call virtual function when it lands.
142 SkImageInfo info = SkImageInfo::Make(0, 0, colorType, fCodec->getInfo().alph aType(), 135 SkImageInfo info = SkImageInfo::Make(0, 0, colorType, fCodec->getInfo().alph aType(),
143 fCodec->getInfo().profileType()); 136 fCodec->getInfo().profileType());
144 return conversion_possible(info, fCodec->getInfo()); 137 return conversion_possible(info, fCodec->getInfo());
145 } 138 }
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