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

Side by Side Diff: Source/WebCore/platform/graphics/chromium/OpaqueRectTrackingContentLayerDelegate.cpp

Issue 14039005: Prevent image downscaling on HiDPI devices with impl-side painting. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 OpaqueRectTrackingContentLayerDelegate::OpaqueRectTrackingContentLayerDelegate(G raphicsContextPainter* painter) 42 OpaqueRectTrackingContentLayerDelegate::OpaqueRectTrackingContentLayerDelegate(G raphicsContextPainter* painter)
43 : m_painter(painter) 43 : m_painter(painter)
44 , m_opaque(false) 44 , m_opaque(false)
45 { 45 {
46 } 46 }
47 47
48 OpaqueRectTrackingContentLayerDelegate::~OpaqueRectTrackingContentLayerDelegate( ) 48 OpaqueRectTrackingContentLayerDelegate::~OpaqueRectTrackingContentLayerDelegate( )
49 { 49 {
50 } 50 }
51 51
52 void OpaqueRectTrackingContentLayerDelegate::paintContents(SkCanvas* canvas, con st WebRect& clip, bool canPaintLCDText, WebFloatRect& opaque) 52 void OpaqueRectTrackingContentLayerDelegate::paintContents(SkCanvas* canvas, con st WebRect& clip, bool canPaintLCDText, WebFloatRect& opaque, bool deferred)
53 { 53 {
54 PlatformContextSkia platformContext(canvas); 54 PlatformContextSkia platformContext(canvas);
55 platformContext.setTrackOpaqueRegion(!m_opaque); 55 platformContext.setTrackOpaqueRegion(!m_opaque);
56 platformContext.setDrawingToImageBuffer(!m_opaque); 56 platformContext.setDrawingToImageBuffer(!m_opaque);
57 platformContext.setDeferred(deferred);
57 GraphicsContext context(&platformContext); 58 GraphicsContext context(&platformContext);
58 context.setShouldSmoothFonts(canPaintLCDText && m_opaque); 59 context.setShouldSmoothFonts(canPaintLCDText && m_opaque);
59 60
60 // Record transform prior to painting, as all opaque tracking will be 61 // Record transform prior to painting, as all opaque tracking will be
61 // relative to this current value. 62 // relative to this current value.
62 AffineTransform canvasToContentTransform = context.getCTM().inverse(); 63 AffineTransform canvasToContentTransform = context.getCTM().inverse();
63 64
64 m_painter->paint(context, clip); 65 m_painter->paint(context, clip);
65 66
66 // Transform tracked opaque paints back to our layer's content space. 67 // Transform tracked opaque paints back to our layer's content space.
67 ASSERT(canvasToContentTransform.isInvertible()); 68 ASSERT(canvasToContentTransform.isInvertible());
68 ASSERT(canvasToContentTransform.preservesAxisAlignment()); 69 ASSERT(canvasToContentTransform.preservesAxisAlignment());
69 opaque = canvasToContentTransform.mapRect(platformContext.opaqueRegion().asR ect()); 70 opaque = canvasToContentTransform.mapRect(platformContext.opaqueRegion().asR ect());
70 } 71 }
71 72
72 } 73 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698