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

Side by Side 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: remove test 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
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 "SkLinearBitmapPipeline.h" 8 #include "SkLinearBitmapPipeline.h"
9 9
10 #include "SkPM4f.h" 10 #include "SkPM4f.h"
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 // As the stages are built, the chooser function may skip a stage. For examp le, with the 769 // As the stages are built, the chooser function may skip a stage. For examp le, with the
770 // identity matrix, the matrix stage is skipped, and the tilerStage is the f irst stage. 770 // identity matrix, the matrix stage is skipped, and the tilerStage is the f irst stage.
771 auto blenderStage = choose_blender(alphaType, postAlpha, &fBlenderStage); 771 auto blenderStage = choose_blender(alphaType, postAlpha, &fBlenderStage);
772 auto samplerStage = choose_pixel_sampler(blenderStage, filterQuality, srcPix map, &fSampleStage); 772 auto samplerStage = choose_pixel_sampler(blenderStage, filterQuality, srcPix map, &fSampleStage);
773 auto tilerStage = choose_tiler(samplerStage, dimensions, xTile, yTile, 773 auto tilerStage = choose_tiler(samplerStage, dimensions, xTile, yTile,
774 filterQuality, dx, &fTileStage); 774 filterQuality, dx, &fTileStage);
775 fFirstStage = choose_matrix(tilerStage, adjustedInverse, &fMatrixStage ); 775 fFirstStage = choose_matrix(tilerStage, adjustedInverse, &fMatrixStage );
776 fLastStage = blenderStage; 776 fLastStage = blenderStage;
777 } 777 }
778 778
779 SkLinearBitmapPipeline::SkLinearBitmapPipeline(
780 const SkLinearBitmapPipeline& pipeline,
781 SkXfermode::Mode mode,
782 const SkPixmap& srcPixmap,
783 const SkImageInfo& dstInfo)
784 {
785 SkASSERT(mode == SkXfermode::kSrc_Mode);
786 SkASSERT(srcPixmap.info().colorType() == dstInfo.colorType()
787 && srcPixmap.info().colorType() == kRGBA_8888_SkColorType);
788
789 fSampleStage.initSink<RGBA8888UnitRepeat>(srcPixmap.writable_addr32(0, 0), s rcPixmap.width());
790 auto sampleStage = fSampleStage.get();
791 auto tilerStage = pipeline.fTileStage.cloneStageTo(sampleStage, &fTileStage) ;
792 tilerStage = (tilerStage != nullptr) ? tilerStage : sampleStage;
793 auto matrixStage = pipeline.fMatrixStage.cloneStageTo(tilerStage, &fMatrixSt age);
794 matrixStage = (matrixStage != nullptr) ? matrixStage : tilerStage;
795 fFirstStage = matrixStage;
796 fLastStage = fSampleStage.getInterface<DestinationInterface, RGBA8888UnitRep eat>();
797 }
mtklein 2016/04/11 16:43:25 It is weird that we've constructed an object here
herb_g 2016/04/12 20:03:49 I think that shadeSpan4f will go away as we restru
798
779 void SkLinearBitmapPipeline::shadeSpan4f(int x, int y, SkPM4f* dst, int count) { 799 void SkLinearBitmapPipeline::shadeSpan4f(int x, int y, SkPM4f* dst, int count) {
780 SkASSERT(count > 0); 800 SkASSERT(count > 0);
801 this->blitSpan(x, y, dst, count);
802 }
803
804 void SkLinearBitmapPipeline::blitSpan(int x, int y, void* dst, int count) {
805 SkASSERT(count > 0);
781 fLastStage->setDestination(dst, count); 806 fLastStage->setDestination(dst, count);
782 807
783 // The count and length arguments start out in a precise relation in order t o keep the 808 // The count and length arguments start out in a precise relation in order t o keep the
784 // math correct through the different stages. Count is the number of pixel t o produce. 809 // math correct through the different stages. Count is the number of pixel t o produce.
785 // Since the code samples at pixel centers, length is the distance from the center of the 810 // Since the code samples at pixel centers, length is the distance from the center of the
786 // first pixel to the center of the last pixel. This implies that length is count-1. 811 // first pixel to the center of the last pixel. This implies that length is count-1.
787 fFirstStage->pointSpan(Span{{x + 0.5f, y + 0.5f}, count - 1.0f, count}); 812 fFirstStage->pointSpan(Span{{x + 0.5f, y + 0.5f}, count - 1.0f, count});
788 } 813 }
OLDNEW
« src/core/SkBitmapProcShader.cpp ('K') | « src/core/SkLinearBitmapPipeline.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698