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

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

Issue 2146413002: Add SkRasterPipeline blitter. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: misleading comment Created 4 years, 5 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
OLDNEW
1 /* 1 /*
2 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 "SkBlitter.h" 8 #include "SkBlitter.h"
9 #include "SkAntiRun.h" 9 #include "SkAntiRun.h"
10 #include "SkColor.h" 10 #include "SkColor.h"
11 #include "SkColorFilter.h" 11 #include "SkColorFilter.h"
12 #include "SkReadBuffer.h" 12 #include "SkReadBuffer.h"
13 #include "SkWriteBuffer.h" 13 #include "SkWriteBuffer.h"
14 #include "SkMask.h" 14 #include "SkMask.h"
15 #include "SkMaskFilter.h" 15 #include "SkMaskFilter.h"
16 #include "SkRasterPipelineBlitter.h"
16 #include "SkString.h" 17 #include "SkString.h"
17 #include "SkTLazy.h" 18 #include "SkTLazy.h"
18 #include "SkUtils.h" 19 #include "SkUtils.h"
19 #include "SkXfermode.h" 20 #include "SkXfermode.h"
20 #include "SkXfermodeInterpretation.h" 21 #include "SkXfermodeInterpretation.h"
21 22
22 // define this for testing srgb blits 23 // define this for testing srgb blits
23 //#define SK_FORCE_PM4f_FOR_L32_BLITS 24 //#define SK_FORCE_PM4f_FOR_L32_BLITS
24 25
25 SkBlitter::~SkBlitter() {} 26 SkBlitter::~SkBlitter() {}
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 if (SkXfermode::IsMode(mode, SkXfermode::kClear_Mode)) { 847 if (SkXfermode::IsMode(mode, SkXfermode::kClear_Mode)) {
847 SkPaint* p = paint.writable(); 848 SkPaint* p = paint.writable();
848 p->setShader(nullptr); 849 p->setShader(nullptr);
849 shader = nullptr; 850 shader = nullptr;
850 p->setColorFilter(nullptr); 851 p->setColorFilter(nullptr);
851 cf = nullptr; 852 cf = nullptr;
852 mode = p->setXfermodeMode(SkXfermode::kSrc_Mode); 853 mode = p->setXfermodeMode(SkXfermode::kSrc_Mode);
853 p->setColor(0); 854 p->setColor(0);
854 } 855 }
855 856
857 if (auto blitter = SkCreateRasterPipelineBlitter(device, *paint)) {
858 return blitter.release();
859 }
860
856 if (nullptr == shader) { 861 if (nullptr == shader) {
857 if (mode) { 862 if (mode) {
858 // xfermodes (and filters) require shaders for our current blitters 863 // xfermodes (and filters) require shaders for our current blitters
859 paint.writable()->setShader(SkShader::MakeColorShader(paint->getColo r())); 864 paint.writable()->setShader(SkShader::MakeColorShader(paint->getColo r()));
860 paint.writable()->setAlpha(0xFF); 865 paint.writable()->setAlpha(0xFF);
861 shader = paint->getShader(); 866 shader = paint->getShader();
862 } else if (cf) { 867 } else if (cf) {
863 // if no shader && no xfermode, we just apply the colorfilter to 868 // if no shader && no xfermode, we just apply the colorfilter to
864 // our color and move on. 869 // our color and move on.
865 SkPaint* writablePaint = paint.writable(); 870 SkPaint* writablePaint = paint.writable();
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1005 fShaderContext->~Context(); 1010 fShaderContext->~Context();
1006 SkShader::Context* ctx = fShader->createContext(rec, (void*)fShaderContext); 1011 SkShader::Context* ctx = fShader->createContext(rec, (void*)fShaderContext);
1007 if (nullptr == ctx) { 1012 if (nullptr == ctx) {
1008 // Need a valid context in fShaderContext's storage, so we can later (or our caller) call 1013 // Need a valid context in fShaderContext's storage, so we can later (or our caller) call
1009 // the in-place destructor. 1014 // the in-place destructor.
1010 new (fShaderContext) SkZeroShaderContext(*fShader, rec); 1015 new (fShaderContext) SkZeroShaderContext(*fShader, rec);
1011 return false; 1016 return false;
1012 } 1017 }
1013 return true; 1018 return true;
1014 } 1019 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698