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

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

Issue 1889753002: remove U16 support, just support F16 (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: address reviewer comments, mostly fixing class/function names 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/SkShader.cpp ('k') | src/core/SkXfermodeF16.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"
(...skipping 16 matching lines...) Expand all
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 = 0;
38 if (src.isOpaque()) { 38 if (src.isOpaque()) {
39 flags |= SkXfermode::kSrcIsOpaque_D64Flag; 39 flags |= SkXfermode::kSrcIsOpaque_F16Flag;
40 } 40 }
41 fWriter = SkXfermode::GetD64Proc(fXfer, flags); 41 fWriter = SkXfermode::GetF16Proc(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::F16Proc 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);
67 67
68 if (paint.getMaskFilter() != nullptr) { 68 if (paint.getMaskFilter() != nullptr) {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
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/SkShader.cpp ('k') | src/core/SkXfermodeF16.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698