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

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

Issue 719213008: SkColorTable locking serves no purpose anymore. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: oops Created 6 years 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/SkConfig8888.cpp ('k') | src/core/SkSpriteBlitter_RGB16.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 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
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 8
9 9
10 #if 0 // experimental 10 #if 0 // experimental
11 11
12 class SkProcSpriteBlitter : public SkSpriteBlitter { 12 class SkProcSpriteBlitter : public SkSpriteBlitter {
13 public: 13 public:
14 typedef void (*Proc)(void* dst, const void* src, int count, const SkPMColor ctable[]); 14 typedef void (*Proc)(void* dst, const void* src, int count, const SkPMColor ctable[]);
15 15
16 SkProcSpriteBlitter(const SkBitmap& source, Proc proc, unsigned srcShift, un signed dstShift) 16 SkProcSpriteBlitter(const SkBitmap& source, Proc proc, unsigned srcShift, un signed dstShift)
17 : SkSpriteBlitter(source), fProc(proc), fSrcShift(SkToU8(srcShift)), fDs tShift(SkToU8(dstShift)) {} 17 : SkSpriteBlitter(source), fProc(proc), fSrcShift(SkToU8(srcShift)), fDs tShift(SkToU8(dstShift)) {}
18 18
19 virtual void blitRect(int x, int y, int width, int height) 19 virtual void blitRect(int x, int y, int width, int height)
20 { 20 {
21 size_t dstRB = fDevice.rowBytes(); 21 size_t dstRB = fDevice.rowBytes();
22 size_t srcRB = fSource.rowBytes(); 22 size_t srcRB = fSource.rowBytes();
23 char* dst = (char*)fDevice.getPixels() + y * dstRB + (x << fDstShi ft); 23 char* dst = (char*)fDevice.getPixels() + y * dstRB + (x << fDstShi ft);
24 const char* src = (const char*)fSource.getPixels() + (y - fTop) * srcRB + ((x - fLeft) << fSrcShift); 24 const char* src = (const char*)fSource.getPixels() + (y - fTop) * srcRB + ((x - fLeft) << fSrcShift);
25 Proc proc = fProc; 25 Proc proc = fProc;
26 const SkPMColor* ctable = NULL; 26 const SkPMColor* ctable = NULL;
27 27
28 if fSource.getColorTable()) 28 if fSource.getColorTable())
29 ctable = fSource.getColorTable()->lockColors(); 29 ctable = fSource.getColorTable()->readColors();
30 30
31 while (--height >= 0) 31 while (--height >= 0)
32 { 32 {
33 proc(dst, src, width, ctable); 33 proc(dst, src, width, ctable);
34 dst += dstRB; 34 dst += dstRB;
35 src += srcRB; 35 src += srcRB;
36 } 36 }
37
38 if fSource.getColorTable())
39 fSource.getColorTable()->unlockColors();
40 } 37 }
41 38
42 private: 39 private:
43 Proc fProc; 40 Proc fProc;
44 uint8_t fSrcShift, fDstShift; 41 uint8_t fSrcShift, fDstShift;
45 }; 42 };
46 43
47 #endif 44 #endif
OLDNEW
« no previous file with comments | « src/core/SkConfig8888.cpp ('k') | src/core/SkSpriteBlitter_RGB16.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698