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

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

Issue 14550002: Making GraphicsContext the owner of PlatformContext. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixing tests and addressing comments. Created 7 years, 7 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
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)
53 { 53 {
54 PlatformContextSkia platformContext(canvas); 54 GraphicsContext context(canvas);
55 platformContext.setTrackOpaqueRegion(!m_opaque); 55 PlatformContextSkia* platformContext = context.platformContext();
56 platformContext.setDrawingToImageBuffer(!m_opaque); 56 platformContext->setTrackOpaqueRegion(!m_opaque);
57 GraphicsContext context(&platformContext); 57 platformContext->setDrawingToImageBuffer(!m_opaque);
58 context.setShouldSmoothFonts(canPaintLCDText && m_opaque); 58 context.setShouldSmoothFonts(canPaintLCDText && m_opaque);
59 59
60 // Record transform prior to painting, as all opaque tracking will be 60 // Record transform prior to painting, as all opaque tracking will be
61 // relative to this current value. 61 // relative to this current value.
62 AffineTransform canvasToContentTransform = context.getCTM().inverse(); 62 AffineTransform canvasToContentTransform = context.getCTM().inverse();
63 63
64 m_painter->paint(context, clip); 64 m_painter->paint(context, clip);
65 65
66 // Transform tracked opaque paints back to our layer's content space. 66 // Transform tracked opaque paints back to our layer's content space.
67 ASSERT(canvasToContentTransform.isInvertible()); 67 ASSERT(canvasToContentTransform.isInvertible());
68 ASSERT(canvasToContentTransform.preservesAxisAlignment()); 68 ASSERT(canvasToContentTransform.preservesAxisAlignment());
69 opaque = canvasToContentTransform.mapRect(platformContext.opaqueRegion().asR ect()); 69 opaque = canvasToContentTransform.mapRect(platformContext->opaqueRegion().as Rect());
70 } 70 }
71 71
72 } 72 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698