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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp

Issue 2441853002: Plumb preferred raster bounds rather than scale (Closed)
Patch Set: none Created 4 years, 1 month 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 (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 client->isTrackingRasterInvalidations()), 103 client->isTrackingRasterInvalidations()),
104 m_paintingPhase(GraphicsLayerPaintAllWithOverflowClip), 104 m_paintingPhase(GraphicsLayerPaintAllWithOverflowClip),
105 m_parent(0), 105 m_parent(0),
106 m_maskLayer(0), 106 m_maskLayer(0),
107 m_contentsClippingMaskLayer(0), 107 m_contentsClippingMaskLayer(0),
108 m_paintCount(0), 108 m_paintCount(0),
109 m_contentsLayer(0), 109 m_contentsLayer(0),
110 m_contentsLayerId(0), 110 m_contentsLayerId(0),
111 m_scrollableArea(nullptr), 111 m_scrollableArea(nullptr),
112 m_renderingContext3d(0), 112 m_renderingContext3d(0),
113 m_preferredRasterScale(1.0f), 113 m_hasPreferredRasterBounds(false) {
114 m_hasPreferredRasterScale(false) {
115 #if ENABLE(ASSERT) 114 #if ENABLE(ASSERT)
116 if (m_client) 115 if (m_client)
117 m_client->verifyNotPainting(); 116 m_client->verifyNotPainting();
118 #endif 117 #endif
119 118
120 m_contentLayerDelegate = wrapUnique(new ContentLayerDelegate(this)); 119 m_contentLayerDelegate = wrapUnique(new ContentLayerDelegate(this));
121 m_layer = Platform::current()->compositorSupport()->createContentLayer( 120 m_layer = Platform::current()->compositorSupport()->createContentLayer(
122 m_contentLayerDelegate.get()); 121 m_contentLayerDelegate.get());
123 m_layer->layer()->setDrawsContent(m_drawsContent && m_contentsVisible); 122 m_layer->layer()->setDrawsContent(m_drawsContent && m_contentsVisible);
124 m_layer->layer()->setLayerClient(this); 123 m_layer->layer()->setLayerClient(this);
(...skipping 19 matching lines...) Expand all
144 LayoutRect GraphicsLayer::visualRect() const { 143 LayoutRect GraphicsLayer::visualRect() const {
145 LayoutRect bounds = LayoutRect(FloatPoint(), size()); 144 LayoutRect bounds = LayoutRect(FloatPoint(), size());
146 bounds.move(offsetFromLayoutObjectWithSubpixelAccumulation()); 145 bounds.move(offsetFromLayoutObjectWithSubpixelAccumulation());
147 return bounds; 146 return bounds;
148 } 147 }
149 148
150 void GraphicsLayer::setHasWillChangeTransformHint(bool hasWillChangeTransform) { 149 void GraphicsLayer::setHasWillChangeTransformHint(bool hasWillChangeTransform) {
151 m_layer->layer()->setHasWillChangeTransformHint(hasWillChangeTransform); 150 m_layer->layer()->setHasWillChangeTransformHint(hasWillChangeTransform);
152 } 151 }
153 152
154 void GraphicsLayer::setPreferredRasterScale(float preferredRasterScale) { 153 void GraphicsLayer::setPreferredRasterBounds(const IntSize& bounds) {
155 m_preferredRasterScale = preferredRasterScale; 154 m_preferredRasterBounds = bounds;
156 m_hasPreferredRasterScale = true; 155 m_hasPreferredRasterBounds = true;
157 m_layer->layer()->setPreferredRasterScale(preferredRasterScale); 156 m_layer->layer()->setPreferredRasterBounds(bounds);
158 } 157 }
159 158
160 void GraphicsLayer::clearPreferredRasterScale() { 159 void GraphicsLayer::clearPreferredRasterBounds() {
161 m_preferredRasterScale = 1.0f; 160 m_preferredRasterBounds = IntSize();
162 m_hasPreferredRasterScale = false; 161 m_hasPreferredRasterBounds = false;
163 m_layer->layer()->clearPreferredRasterScale(); 162 m_layer->layer()->clearPreferredRasterBounds();
164 } 163 }
165 164
166 void GraphicsLayer::setParent(GraphicsLayer* layer) { 165 void GraphicsLayer::setParent(GraphicsLayer* layer) {
167 ASSERT(!layer || !layer->hasAncestor(this)); 166 ASSERT(!layer || !layer->hasAncestor(this));
168 m_parent = layer; 167 m_parent = layer;
169 } 168 }
170 169
171 #if ENABLE(ASSERT) 170 #if ENABLE(ASSERT)
172 171
173 bool GraphicsLayer::hasAncestor(GraphicsLayer* ancestor) const { 172 bool GraphicsLayer::hasAncestor(GraphicsLayer* ancestor) const {
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 if (m_drawsContent) 679 if (m_drawsContent)
681 json->setBoolean("drawsContent", m_drawsContent); 680 json->setBoolean("drawsContent", m_drawsContent);
682 681
683 if (!m_contentsVisible) 682 if (!m_contentsVisible)
684 json->setBoolean("contentsVisible", m_contentsVisible); 683 json->setBoolean("contentsVisible", m_contentsVisible);
685 684
686 if (!m_backfaceVisibility) 685 if (!m_backfaceVisibility)
687 json->setString("backfaceVisibility", 686 json->setString("backfaceVisibility",
688 m_backfaceVisibility ? "visible" : "hidden"); 687 m_backfaceVisibility ? "visible" : "hidden");
689 688
690 if (m_hasPreferredRasterScale) 689 if (m_hasPreferredRasterBounds) {
691 json->setDouble("preferredRasterScale", m_preferredRasterScale); 690 json->setArray("preferredRasterBounds",
691 sizeAsJSONArray(m_preferredRasterBounds));
692 }
692 693
693 if (flags & LayerTreeIncludesDebugInfo) 694 if (flags & LayerTreeIncludesDebugInfo)
694 json->setString("client", pointerAsString(m_client)); 695 json->setString("client", pointerAsString(m_client));
695 696
696 if (m_backgroundColor.alpha()) 697 if (m_backgroundColor.alpha())
697 json->setString("backgroundColor", 698 json->setString("backgroundColor",
698 m_backgroundColor.nameForLayoutTreeAsText()); 699 m_backgroundColor.nameForLayoutTreeAsText());
699 700
700 if (!m_transform.isIdentity()) 701 if (!m_transform.isIdentity())
701 json->setArray("transform", transformAsJSONArray(m_transform)); 702 json->setArray("transform", transformAsJSONArray(m_transform));
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
1290 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) { 1291 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) {
1291 if (!layer) { 1292 if (!layer) {
1292 fprintf(stderr, "Cannot showGraphicsLayerTree for (nil).\n"); 1293 fprintf(stderr, "Cannot showGraphicsLayerTree for (nil).\n");
1293 return; 1294 return;
1294 } 1295 }
1295 1296
1296 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); 1297 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo);
1297 fprintf(stderr, "%s\n", output.utf8().data()); 1298 fprintf(stderr, "%s\n", output.utf8().data());
1298 } 1299 }
1299 #endif 1300 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/GraphicsLayer.h ('k') | third_party/WebKit/public/platform/WebLayer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698