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

Side by Side Diff: Source/core/rendering/compositing/CompositedLayerMapping.cpp

Issue 323013004: Clean up transform methods in GraphicsContext. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2nd Attempt Mac build fix 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2009, 2010, 2011 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 1978 matching lines...) Expand 10 before | Expand all | Expand 10 after
1989 else if (compositor()->fixedRootBackgroundLayer()) 1989 else if (compositor()->fixedRootBackgroundLayer())
1990 paintFlags |= PaintLayerPaintingSkipRootBackground; 1990 paintFlags |= PaintLayerPaintingSkipRootBackground;
1991 1991
1992 // Note carefully: in theory it is appropriate to invoke context->save() her e 1992 // Note carefully: in theory it is appropriate to invoke context->save() her e
1993 // and restore the context after painting. For efficiency, we are assuming t hat 1993 // and restore the context after painting. For efficiency, we are assuming t hat
1994 // it is equivalent to manually undo this offset translation, which means we are 1994 // it is equivalent to manually undo this offset translation, which means we are
1995 // assuming that the context's space was not affected by the RenderLayer 1995 // assuming that the context's space was not affected by the RenderLayer
1996 // painting code. 1996 // painting code.
1997 1997
1998 IntSize offset = paintInfo.offsetFromRenderer; 1998 IntSize offset = paintInfo.offsetFromRenderer;
1999 context->translate(-offset); 1999 context->translate(-offset.width(), -offset.height());
2000 2000
2001 // The dirtyRect is in the coords of the painting root. 2001 // The dirtyRect is in the coords of the painting root.
2002 IntRect dirtyRect(clip); 2002 IntRect dirtyRect(clip);
2003 dirtyRect.move(offset); 2003 dirtyRect.move(offset);
2004 2004
2005 if (!(paintInfo.paintingPhase & GraphicsLayerPaintOverflowContents)) { 2005 if (!(paintInfo.paintingPhase & GraphicsLayerPaintOverflowContents)) {
2006 LayoutRect bounds = paintInfo.compositedBounds; 2006 LayoutRect bounds = paintInfo.compositedBounds;
2007 bounds.move(paintInfo.renderLayer->subpixelAccumulation()); 2007 bounds.move(paintInfo.renderLayer->subpixelAccumulation());
2008 dirtyRect.intersect(pixelSnappedIntRect(bounds)); 2008 dirtyRect.intersect(pixelSnappedIntRect(bounds));
2009 } else { 2009 } else {
(...skipping 23 matching lines...) Expand all
2033 context->save(); 2033 context->save();
2034 dirtyRect.intersect(paintInfo.localClipRectForSquashedLayer); 2034 dirtyRect.intersect(paintInfo.localClipRectForSquashedLayer);
2035 context->clip(dirtyRect); 2035 context->clip(dirtyRect);
2036 paintInfo.renderLayer->paintLayer(context, paintingInfo, paintFlags); 2036 paintInfo.renderLayer->paintLayer(context, paintingInfo, paintFlags);
2037 context->restore(); 2037 context->restore();
2038 } 2038 }
2039 2039
2040 ASSERT(!paintInfo.renderLayer->usedTransparency()); 2040 ASSERT(!paintInfo.renderLayer->usedTransparency());
2041 2041
2042 // Manually restore the context to its original state by applying the opposi te translation. 2042 // Manually restore the context to its original state by applying the opposi te translation.
2043 context->translate(offset); 2043 context->translate(offset.width(), offset.height());
2044 } 2044 }
2045 2045
2046 static void paintScrollbar(Scrollbar* scrollbar, GraphicsContext& context, const IntRect& clip) 2046 static void paintScrollbar(Scrollbar* scrollbar, GraphicsContext& context, const IntRect& clip)
2047 { 2047 {
2048 if (!scrollbar) 2048 if (!scrollbar)
2049 return; 2049 return;
2050 2050
2051 context.save(); 2051 context.save();
2052 const IntRect& scrollbarRect = scrollbar->frameRect(); 2052 const IntRect& scrollbarRect = scrollbar->frameRect();
2053 context.translate(-scrollbarRect.x(), -scrollbarRect.y()); 2053 context.translate(-scrollbarRect.x(), -scrollbarRect.y());
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
2240 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { 2240 } else if (graphicsLayer == m_scrollingContentsLayer.get()) {
2241 name = "Scrolling Contents Layer"; 2241 name = "Scrolling Contents Layer";
2242 } else { 2242 } else {
2243 ASSERT_NOT_REACHED(); 2243 ASSERT_NOT_REACHED();
2244 } 2244 }
2245 2245
2246 return name; 2246 return name;
2247 } 2247 }
2248 2248
2249 } // namespace WebCore 2249 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderWidget.cpp ('k') | Source/core/rendering/svg/RenderSVGResourceFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698