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

Side by Side Diff: src/core/SkConfig8888.cpp

Issue 1703013002: misc fixes to make float buffers work a little better (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 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 | « src/core/SkBlitter.cpp ('k') | 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 2014 Google Inc. 2 * Copyright 2014 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 "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkConfig8888.h" 10 #include "SkConfig8888.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 dst8 += dstRB; 166 dst8 += dstRB;
167 } 167 }
168 } 168 }
169 169
170 bool SkPixelInfo::CopyPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRB, 170 bool SkPixelInfo::CopyPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRB,
171 const SkImageInfo& srcInfo, const void* srcPixels, size_t srcRB, 171 const SkImageInfo& srcInfo, const void* srcPixels, size_t srcRB,
172 SkColorTable* ctable) { 172 SkColorTable* ctable) {
173 if (srcInfo.dimensions() != dstInfo.dimensions()) { 173 if (srcInfo.dimensions() != dstInfo.dimensions()) {
174 return false; 174 return false;
175 } 175 }
176 176
177 const int width = srcInfo.width(); 177 const int width = srcInfo.width();
178 const int height = srcInfo.height(); 178 const int height = srcInfo.height();
179
180 // Do the easiest one first : both configs are equal
181 if ((srcInfo == dstInfo) && !ctable) {
182 size_t bytes = width * srcInfo.bytesPerPixel();
183 for (int y = 0; y < height; ++y) {
184 memcpy(dstPixels, srcPixels, bytes);
185 srcPixels = (const char*)srcPixels + srcRB;
186 dstPixels = (char*)dstPixels + dstRB;
187 }
188 return true;
189 }
179 190
180 // Handle fancy alpha swizzling if both are ARGB32 191 // Handle fancy alpha swizzling if both are ARGB32
181 if (4 == srcInfo.bytesPerPixel() && 4 == dstInfo.bytesPerPixel()) { 192 if (4 == srcInfo.bytesPerPixel() && 4 == dstInfo.bytesPerPixel()) {
182 SkDstPixelInfo dstPI; 193 SkDstPixelInfo dstPI;
183 dstPI.fColorType = dstInfo.colorType(); 194 dstPI.fColorType = dstInfo.colorType();
184 dstPI.fAlphaType = dstInfo.alphaType(); 195 dstPI.fAlphaType = dstInfo.alphaType();
185 dstPI.fPixels = dstPixels; 196 dstPI.fPixels = dstPixels;
186 dstPI.fRowBytes = dstRB; 197 dstPI.fRowBytes = dstRB;
187 198
188 SkSrcPixelInfo srcPI; 199 SkSrcPixelInfo srcPI;
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 297
287 SkPaint paint; 298 SkPaint paint;
288 paint.setDither(true); 299 paint.setDither(true);
289 300
290 canvas->clear(0); 301 canvas->clear(0);
291 canvas->drawBitmap(bm, 0, 0, &paint); 302 canvas->drawBitmap(bm, 0, 0, &paint);
292 return true; 303 return true;
293 } 304 }
294 } 305 }
295 306
OLDNEW
« no previous file with comments | « src/core/SkBlitter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698