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

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

Issue 1842753002: Style bikeshed - remove extraneous whitespace (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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/SkSpecialSurface.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 * Copyright 2016 Google Inc. 2 * Copyright 2016 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 "SkSpriteBlitter.h" 8 #include "SkSpriteBlitter.h"
9 #include "SkSpanProcs.h" 9 #include "SkSpanProcs.h"
10 #include "SkTemplates.h" 10 #include "SkTemplates.h"
11 #include "SkXfermode.h" 11 #include "SkXfermode.h"
12 12
13 class Sprite_4f : public SkSpriteBlitter { 13 class Sprite_4f : public SkSpriteBlitter {
14 public: 14 public:
15 Sprite_4f(const SkPixmap& src, const SkPaint& paint) : INHERITED(src) { 15 Sprite_4f(const SkPixmap& src, const SkPaint& paint) : INHERITED(src) {
16 fXfer = paint.getXfermode(); 16 fXfer = paint.getXfermode();
17 fLoader = SkLoadSpanProc_Choose(src.info()); 17 fLoader = SkLoadSpanProc_Choose(src.info());
18 fFilter = SkFilterSpanProc_Choose(paint); 18 fFilter = SkFilterSpanProc_Choose(paint);
19 fBuffer.reset(src.width()); 19 fBuffer.reset(src.width());
20 } 20 }
21 21
22 protected: 22 protected:
23 SkXfermode* fXfer; 23 SkXfermode* fXfer;
24 SkLoadSpanProc fLoader; 24 SkLoadSpanProc fLoader;
25 SkFilterSpanProc fFilter; 25 SkFilterSpanProc fFilter;
26 SkAutoTMalloc<SkPM4f> fBuffer; 26 SkAutoTMalloc<SkPM4f> fBuffer;
27 27
28 private: 28 private:
29 typedef SkSpriteBlitter INHERITED; 29 typedef SkSpriteBlitter INHERITED;
30 }; 30 };
31 31
32 //////////////////////////////////////////////////////////////////////////////// /////////////////// 32 //////////////////////////////////////////////////////////////////////////////// ///////////////////
33 33
34 class Sprite_F16 : public Sprite_4f { 34 class Sprite_F16 : public Sprite_4f {
35 public: 35 public:
36 Sprite_F16(const SkPixmap& src, const SkPaint& paint) : INHERITED(src, paint ) { 36 Sprite_F16(const SkPixmap& src, const SkPaint& paint) : INHERITED(src, paint ) {
37 uint32_t flags = SkXfermode::kDstIsFloat16_D64Flag; 37 uint32_t flags = SkXfermode::kDstIsFloat16_D64Flag;
38 if (src.isOpaque()) { 38 if (src.isOpaque()) {
39 flags |= SkXfermode::kSrcIsOpaque_D64Flag; 39 flags |= SkXfermode::kSrcIsOpaque_D64Flag;
40 } 40 }
41 fWriter = SkXfermode::GetD64Proc(fXfer, flags); 41 fWriter = SkXfermode::GetD64Proc(fXfer, flags);
42 } 42 }
43 43
44 void blitRect(int x, int y, int width, int height) override { 44 void blitRect(int x, int y, int width, int height) override {
45 SkASSERT(width > 0 && height > 0); 45 SkASSERT(width > 0 && height > 0);
46 uint64_t* SK_RESTRICT dst = fDst.writable_addr64(x, y); 46 uint64_t* SK_RESTRICT dst = fDst.writable_addr64(x, y);
47 size_t dstRB = fDst.rowBytes(); 47 size_t dstRB = fDst.rowBytes();
48 48
49 for (int bottom = y + height; y < bottom; ++y) { 49 for (int bottom = y + height; y < bottom; ++y) {
50 fLoader(fSource, x - fLeft, y - fTop, fBuffer, width); 50 fLoader(fSource, x - fLeft, y - fTop, fBuffer, width);
51 fFilter(*fPaint, fBuffer, width); 51 fFilter(*fPaint, fBuffer, width);
52 fWriter(fXfer, dst, fBuffer, width, nullptr); 52 fWriter(fXfer, dst, fBuffer, width, nullptr);
53 dst = (uint64_t* SK_RESTRICT)((char*)dst + dstRB); 53 dst = (uint64_t* SK_RESTRICT)((char*)dst + dstRB);
54 } 54 }
55 } 55 }
56 56
57 private: 57 private:
58 SkXfermode::D64Proc fWriter; 58 SkXfermode::D64Proc fWriter;
59 59
60 typedef Sprite_4f INHERITED; 60 typedef Sprite_4f INHERITED;
61 }; 61 };
62 62
63 63
64 SkSpriteBlitter* SkSpriteBlitter::ChooseF16(const SkPixmap& source, const SkPain t& paint, 64 SkSpriteBlitter* SkSpriteBlitter::ChooseF16(const SkPixmap& source, const SkPain t& paint,
65 SkTBlitterAllocator* allocator) { 65 SkTBlitterAllocator* allocator) {
66 SkASSERT(allocator != nullptr); 66 SkASSERT(allocator != nullptr);
(...skipping 15 matching lines...) Expand all
82 82
83 class Sprite_sRGB : public Sprite_4f { 83 class Sprite_sRGB : public Sprite_4f {
84 public: 84 public:
85 Sprite_sRGB(const SkPixmap& src, const SkPaint& paint) : INHERITED(src, pain t) { 85 Sprite_sRGB(const SkPixmap& src, const SkPaint& paint) : INHERITED(src, pain t) {
86 uint32_t flags = SkXfermode::kDstIsSRGB_D32Flag; 86 uint32_t flags = SkXfermode::kDstIsSRGB_D32Flag;
87 if (src.isOpaque()) { 87 if (src.isOpaque()) {
88 flags |= SkXfermode::kSrcIsOpaque_D32Flag; 88 flags |= SkXfermode::kSrcIsOpaque_D32Flag;
89 } 89 }
90 fWriter = SkXfermode::GetD32Proc(fXfer, flags); 90 fWriter = SkXfermode::GetD32Proc(fXfer, flags);
91 } 91 }
92 92
93 void blitRect(int x, int y, int width, int height) override { 93 void blitRect(int x, int y, int width, int height) override {
94 SkASSERT(width > 0 && height > 0); 94 SkASSERT(width > 0 && height > 0);
95 uint32_t* SK_RESTRICT dst = fDst.writable_addr32(x, y); 95 uint32_t* SK_RESTRICT dst = fDst.writable_addr32(x, y);
96 size_t dstRB = fDst.rowBytes(); 96 size_t dstRB = fDst.rowBytes();
97 97
98 for (int bottom = y + height; y < bottom; ++y) { 98 for (int bottom = y + height; y < bottom; ++y) {
99 fLoader(fSource, x - fLeft, y - fTop, fBuffer, width); 99 fLoader(fSource, x - fLeft, y - fTop, fBuffer, width);
100 fFilter(*fPaint, fBuffer, width); 100 fFilter(*fPaint, fBuffer, width);
101 fWriter(fXfer, dst, fBuffer, width, nullptr); 101 fWriter(fXfer, dst, fBuffer, width, nullptr);
102 dst = (uint32_t* SK_RESTRICT)((char*)dst + dstRB); 102 dst = (uint32_t* SK_RESTRICT)((char*)dst + dstRB);
103 } 103 }
104 } 104 }
105 105
106 protected: 106 protected:
107 SkXfermode::D32Proc fWriter; 107 SkXfermode::D32Proc fWriter;
108 108
109 private: 109 private:
110 typedef Sprite_4f INHERITED; 110 typedef Sprite_4f INHERITED;
111 }; 111 };
112 112
113 113
114 SkSpriteBlitter* SkSpriteBlitter::ChooseS32(const SkPixmap& source, const SkPain t& paint, 114 SkSpriteBlitter* SkSpriteBlitter::ChooseS32(const SkPixmap& source, const SkPain t& paint,
115 SkTBlitterAllocator* allocator) { 115 SkTBlitterAllocator* allocator) {
116 SkASSERT(allocator != nullptr); 116 SkASSERT(allocator != nullptr);
117 117
118 if (paint.getMaskFilter() != nullptr) { 118 if (paint.getMaskFilter() != nullptr) {
119 return nullptr; 119 return nullptr;
120 } 120 }
121 121
122 switch (source.colorType()) { 122 switch (source.colorType()) {
123 case kN32_SkColorType: 123 case kN32_SkColorType:
124 case kRGBA_F16_SkColorType: 124 case kRGBA_F16_SkColorType:
125 return allocator->createT<Sprite_sRGB>(source, paint); 125 return allocator->createT<Sprite_sRGB>(source, paint);
126 default: 126 default:
127 return nullptr; 127 return nullptr;
128 } 128 }
129 } 129 }
OLDNEW
« no previous file with comments | « src/core/SkSpecialSurface.cpp ('k') | src/core/SkSpriteBlitter_RGB16.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698