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

Unified Diff: src/core/SkLinearBitmapPipeline.cpp

Issue 1852613002: First blitter for linear pipeline. (Closed) Base URL: https://skia.googlesource.com/skia.git@clone-the-pipeline
Patch Set: Moved check and construction of blitter pipeline to SkLinearBitmapPipeline. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkLinearBitmapPipeline.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkLinearBitmapPipeline.cpp
diff --git a/src/core/SkLinearBitmapPipeline.cpp b/src/core/SkLinearBitmapPipeline.cpp
index 539547af9a903288f63a772e9a7be08b9666a614..cf69e974ddb61b1ccf0e077d460678e648bfcfd4 100644
--- a/src/core/SkLinearBitmapPipeline.cpp
+++ b/src/core/SkLinearBitmapPipeline.cpp
@@ -776,8 +776,69 @@ SkLinearBitmapPipeline::SkLinearBitmapPipeline(
fLastStage = blenderStage;
}
+bool SkLinearBitmapPipeline::ClonePipelineForBlitting(
+ void* blitterStorage,
+ const SkLinearBitmapPipeline& pipeline,
+ SkMatrix::TypeMask matrixMask,
+ SkShader::TileMode xTileMode,
+ SkShader::TileMode yTileMode,
+ SkFilterQuality filterQuality,
+ const SkPixmap& srcPixmap,
+ float finalAlpha,
+ SkXfermode::Mode xferMode,
+ const SkImageInfo& dstInfo)
+{
+ if (matrixMask & ~SkMatrix::kTranslate_Mask ) { return false; }
+ if (filterQuality != SkFilterQuality::kNone_SkFilterQuality) { return false; }
+ if (finalAlpha != 1.0f) { return false; }
+ if (srcPixmap.info().colorType() != kRGBA_8888_SkColorType
+ || dstInfo.colorType() != kRGBA_8888_SkColorType) { return false; }
+
+ if (srcPixmap.info().profileType() != dstInfo.profileType()) { return false; }
+
+ if (xTileMode != SkShader::kRepeat_TileMode || yTileMode != SkShader::kRepeat_TileMode) {
+ return false;
+ }
+
+ if (xferMode == SkXfermode::kSrcOver_Mode
+ && srcPixmap.info().alphaType() == kOpaque_SkAlphaType) {
+ xferMode = SkXfermode::kSrc_Mode;
+ }
+
+ if (xferMode != SkXfermode::kSrc_Mode) { return false; }
+
+ new (blitterStorage) SkLinearBitmapPipeline(pipeline, srcPixmap, xferMode, dstInfo);
+
+ return true;
+}
+
+SkLinearBitmapPipeline::SkLinearBitmapPipeline(
+ const SkLinearBitmapPipeline& pipeline,
+ const SkPixmap& srcPixmap,
+ SkXfermode::Mode mode,
+ const SkImageInfo& dstInfo)
+{
+ SkASSERT(mode == SkXfermode::kSrc_Mode);
+ SkASSERT(srcPixmap.info().colorType() == dstInfo.colorType()
+ && srcPixmap.info().colorType() == kRGBA_8888_SkColorType);
+
+ fSampleStage.initSink<RGBA8888UnitRepeat>(srcPixmap.writable_addr32(0, 0), srcPixmap.width());
+ auto sampleStage = fSampleStage.get();
+ auto tilerStage = pipeline.fTileStage.cloneStageTo(sampleStage, &fTileStage);
+ tilerStage = (tilerStage != nullptr) ? tilerStage : sampleStage;
+ auto matrixStage = pipeline.fMatrixStage.cloneStageTo(tilerStage, &fMatrixStage);
+ matrixStage = (matrixStage != nullptr) ? matrixStage : tilerStage;
+ fFirstStage = matrixStage;
+ fLastStage = fSampleStage.getInterface<DestinationInterface, RGBA8888UnitRepeat>();
+}
+
void SkLinearBitmapPipeline::shadeSpan4f(int x, int y, SkPM4f* dst, int count) {
SkASSERT(count > 0);
+ this->blitSpan(x, y, dst, count);
+}
+
+void SkLinearBitmapPipeline::blitSpan(int x, int y, void* dst, int count) {
+ SkASSERT(count > 0);
fLastStage->setDestination(dst, count);
// The count and length arguments start out in a precise relation in order to keep the
« no previous file with comments | « src/core/SkLinearBitmapPipeline.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698