OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "PictureRenderer.h" | 8 #include "PictureRenderer.h" |
9 #include "picture_utils.h" | 9 #include "picture_utils.h" |
10 #include "SamplePipeControllers.h" | 10 #include "SamplePipeControllers.h" |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 */ | 611 */ |
612 static void draw_tile_to_canvas(SkCanvas* canvas, | 612 static void draw_tile_to_canvas(SkCanvas* canvas, |
613 const SkIRect& tileRect, | 613 const SkIRect& tileRect, |
614 const SkPicture* picture) { | 614 const SkPicture* picture) { |
615 int saveCount = canvas->save(); | 615 int saveCount = canvas->save(); |
616 // Translate so that we draw the correct portion of the picture. | 616 // Translate so that we draw the correct portion of the picture. |
617 // Perform a postTranslate so that the scaleFactor does not interfere with t
he positioning. | 617 // Perform a postTranslate so that the scaleFactor does not interfere with t
he positioning. |
618 SkMatrix mat(canvas->getTotalMatrix()); | 618 SkMatrix mat(canvas->getTotalMatrix()); |
619 mat.postTranslate(-SkIntToScalar(tileRect.fLeft), -SkIntToScalar(tileRect.fT
op)); | 619 mat.postTranslate(-SkIntToScalar(tileRect.fLeft), -SkIntToScalar(tileRect.fT
op)); |
620 canvas->setMatrix(mat); | 620 canvas->setMatrix(mat); |
| 621 canvas->clipRect(SkRect::Make(tileRect)); |
621 canvas->clear(SK_ColorTRANSPARENT); // Not every picture covers the entirety
of every tile | 622 canvas->clear(SK_ColorTRANSPARENT); // Not every picture covers the entirety
of every tile |
622 canvas->drawPicture(picture); | 623 canvas->drawPicture(picture); |
623 canvas->restoreToCount(saveCount); | 624 canvas->restoreToCount(saveCount); |
624 canvas->flush(); | 625 canvas->flush(); |
625 } | 626 } |
626 | 627 |
627 ////////////////////////////////////////////////////////////////////////////////
/////////////// | 628 ////////////////////////////////////////////////////////////////////////////////
/////////////// |
628 | 629 |
629 /** | 630 /** |
630 * Copies the entirety of the src bitmap (typically a tile) into a portion of th
e dst bitmap. | 631 * Copies the entirety of the src bitmap (typically a tile) into a portion of th
e dst bitmap. |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 PictureRenderer* CreateGatherPixelRefsRenderer(const GrContext::Options& opts) { | 854 PictureRenderer* CreateGatherPixelRefsRenderer(const GrContext::Options& opts) { |
854 return SkNEW_ARGS(GatherRenderer, (opts)); | 855 return SkNEW_ARGS(GatherRenderer, (opts)); |
855 } | 856 } |
856 #else | 857 #else |
857 PictureRenderer* CreateGatherPixelRefsRenderer() { | 858 PictureRenderer* CreateGatherPixelRefsRenderer() { |
858 return SkNEW(GatherRenderer); | 859 return SkNEW(GatherRenderer); |
859 } | 860 } |
860 #endif | 861 #endif |
861 | 862 |
862 } // namespace sk_tools | 863 } // namespace sk_tools |
OLD | NEW |