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

Side by Side Diff: cc/layers/picture_image_layer.cc

Issue 315393002: Record SkPicture with correct LCD text setting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: better unittest Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/layers/picture_image_layer.h" 5 #include "cc/layers/picture_image_layer.h"
6 6
7 #include "cc/layers/picture_image_layer_impl.h" 7 #include "cc/layers/picture_image_layer_impl.h"
8 #include "third_party/skia/include/core/SkCanvas.h" 8 #include "third_party/skia/include/core/SkCanvas.h"
9 9
10 namespace cc { 10 namespace cc {
(...skipping 25 matching lines...) Expand all
36 if (bitmap.pixelRef() && bitmap.pixelRef() == bitmap_.pixelRef()) 36 if (bitmap.pixelRef() && bitmap.pixelRef() == bitmap_.pixelRef())
37 return; 37 return;
38 38
39 bitmap_ = bitmap; 39 bitmap_ = bitmap;
40 SetNeedsDisplay(); 40 SetNeedsDisplay();
41 } 41 }
42 42
43 void PictureImageLayer::PaintContents( 43 void PictureImageLayer::PaintContents(
44 SkCanvas* canvas, 44 SkCanvas* canvas,
45 const gfx::Rect& clip, 45 const gfx::Rect& clip,
46 bool can_paint_lcd_text,
46 gfx::RectF* opaque, 47 gfx::RectF* opaque,
47 ContentLayerClient::GraphicsContextStatus gc_status) { 48 ContentLayerClient::GraphicsContextStatus gc_status) {
48 if (!bitmap_.width() || !bitmap_.height()) 49 if (!bitmap_.width() || !bitmap_.height())
49 return; 50 return;
50 51
51 SkScalar content_to_layer_scale_x = 52 SkScalar content_to_layer_scale_x =
52 SkFloatToScalar(static_cast<float>(bounds().width()) / bitmap_.width()); 53 SkFloatToScalar(static_cast<float>(bounds().width()) / bitmap_.width());
53 SkScalar content_to_layer_scale_y = 54 SkScalar content_to_layer_scale_y =
54 SkFloatToScalar(static_cast<float>(bounds().height()) / bitmap_.height()); 55 SkFloatToScalar(static_cast<float>(bounds().height()) / bitmap_.height());
55 canvas->scale(content_to_layer_scale_x, content_to_layer_scale_y); 56 canvas->scale(content_to_layer_scale_x, content_to_layer_scale_y);
56 57
57 // Because PictureImageLayer always FillsBoundsCompletely it will not clear 58 // Because PictureImageLayer always FillsBoundsCompletely it will not clear
58 // before painting on playback. As a result we must configure the paint to 59 // before painting on playback. As a result we must configure the paint to
59 // copy over the uncleared destination, rather than blending with it. 60 // copy over the uncleared destination, rather than blending with it.
60 SkPaint paint; 61 SkPaint paint;
61 paint.setXfermodeMode(SkXfermode::kSrc_Mode); 62 paint.setXfermodeMode(SkXfermode::kSrc_Mode);
62 canvas->drawBitmap(bitmap_, 0, 0, &paint); 63 canvas->drawBitmap(bitmap_, 0, 0, &paint);
63 } 64 }
64 65
66 bool PictureImageLayer::PaintsLCDText() const {
67 return false;
68 }
69
65 bool PictureImageLayer::FillsBoundsCompletely() const { 70 bool PictureImageLayer::FillsBoundsCompletely() const {
66 // PictureImageLayer will always paint to the entire layer bounds. 71 // PictureImageLayer will always paint to the entire layer bounds.
67 return true; 72 return true;
68 } 73 }
69 74
70 } // namespace cc 75 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698