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

Side by Side Diff: Source/core/frame/LocalFrame.cpp

Issue 1170523002: Removing GraphicsContext from ImageBuffer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix unit test crashes Created 5 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 /* 1 /*
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 * 1999 Lars Knoll <knoll@kde.org> 3 * 1999 Lars Knoll <knoll@kde.org>
4 * 1999 Antti Koivisto <koivisto@kde.org> 4 * 1999 Antti Koivisto <koivisto@kde.org>
5 * 2000 Simon Hausmann <hausmann@kde.org> 5 * 2000 Simon Hausmann <hausmann@kde.org>
6 * 2000 Stefan Schimanski <1Stein@gmx.de> 6 * 2000 Stefan Schimanski <1Stein@gmx.de>
7 * 2001 George Staikos <staikos@kde.org> 7 * 2001 George Staikos <staikos@kde.org>
8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
9 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com> 9 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com>
10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 #include "core/page/scrolling/ScrollingCoordinator.h" 63 #include "core/page/scrolling/ScrollingCoordinator.h"
64 #include "core/paint/DeprecatedPaintLayer.h" 64 #include "core/paint/DeprecatedPaintLayer.h"
65 #include "core/paint/TransformRecorder.h" 65 #include "core/paint/TransformRecorder.h"
66 #include "core/svg/SVGDocumentExtensions.h" 66 #include "core/svg/SVGDocumentExtensions.h"
67 #include "platform/DragImage.h" 67 #include "platform/DragImage.h"
68 #include "platform/RuntimeEnabledFeatures.h" 68 #include "platform/RuntimeEnabledFeatures.h"
69 #include "platform/ScriptForbiddenScope.h" 69 #include "platform/ScriptForbiddenScope.h"
70 #include "platform/graphics/GraphicsContext.h" 70 #include "platform/graphics/GraphicsContext.h"
71 #include "platform/graphics/ImageBuffer.h" 71 #include "platform/graphics/ImageBuffer.h"
72 #include "platform/graphics/paint/ClipRecorder.h" 72 #include "platform/graphics/paint/ClipRecorder.h"
73 #include "platform/graphics/paint/DisplayItemListContextRecorder.h" 73 #include "platform/graphics/paint/SkPictureBuilder.h"
74 #include "platform/text/TextStream.h" 74 #include "platform/text/TextStream.h"
75 #include "wtf/PassOwnPtr.h" 75 #include "wtf/PassOwnPtr.h"
76 #include "wtf/StdLibExtras.h" 76 #include "wtf/StdLibExtras.h"
77 77
78 namespace blink { 78 namespace blink {
79 79
80 using namespace HTMLNames; 80 using namespace HTMLNames;
81 81
82 namespace { 82 namespace {
83 83
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 { 560 {
561 ASSERT(document()->isActive()); 561 ASSERT(document()->isActive());
562 float deviceScaleFactor = m_host->deviceScaleFactor(); 562 float deviceScaleFactor = m_host->deviceScaleFactor();
563 paintingRect.setWidth(paintingRect.width() * deviceScaleFactor); 563 paintingRect.setWidth(paintingRect.width() * deviceScaleFactor);
564 paintingRect.setHeight(paintingRect.height() * deviceScaleFactor); 564 paintingRect.setHeight(paintingRect.height() * deviceScaleFactor);
565 565
566 OwnPtr<ImageBuffer> buffer = ImageBuffer::create(paintingRect.size()); 566 OwnPtr<ImageBuffer> buffer = ImageBuffer::create(paintingRect.size());
567 if (!buffer) 567 if (!buffer)
568 return nullptr; 568 return nullptr;
569 569
570 SkPictureBuilder pictureBuilder(paintingRect);
570 { 571 {
571 DisplayItemListContextRecorder contextRecorder(*buffer->context()); 572 GraphicsContext& paintContext = pictureBuilder.context();
572 GraphicsContext& paintContext = contextRecorder.context();
573 573
574 AffineTransform transform; 574 AffineTransform transform;
575 transform.scale(deviceScaleFactor, deviceScaleFactor); 575 transform.scale(deviceScaleFactor, deviceScaleFactor);
576 transform.translate(-paintingRect.x(), -paintingRect.y()); 576 transform.translate(-paintingRect.x(), -paintingRect.y());
577 TransformRecorder transformRecorder(paintContext, displayItemClient, tra nsform); 577 TransformRecorder transformRecorder(paintContext, displayItemClient, tra nsform);
578 578
579 ClipRecorder clipRecorder(paintContext, displayItemClient, clipType, 579 ClipRecorder clipRecorder(paintContext, displayItemClient, clipType,
580 LayoutRect(0, 0, paintingRect.maxX(), paintingRect.maxY())); 580 LayoutRect(0, 0, paintingRect.maxX(), paintingRect.maxY()));
581 581
582 m_view->paintContents(&paintContext, paintingRect); 582 m_view->paintContents(&paintContext, paintingRect);
583
583 } 584 }
585 RefPtr<const SkPicture> recording = pictureBuilder.endRecording();
586 buffer->canvas()->drawPicture(recording.get());
584 587
585 RefPtr<Image> image = buffer->copyImage(); 588 RefPtr<Image> image = buffer->copyImage();
586 return DragImage::create(image.get(), shouldRespectImageOrientation, deviceS caleFactor); 589 return DragImage::create(image.get(), shouldRespectImageOrientation, deviceS caleFactor);
587 } 590 }
588 591
589 PassOwnPtr<DragImage> LocalFrame::nodeImage(Node& node) 592 PassOwnPtr<DragImage> LocalFrame::nodeImage(Node& node)
590 { 593 {
591 if (!node.layoutObject()) 594 if (!node.layoutObject())
592 return nullptr; 595 return nullptr;
593 596
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 , m_textZoomFactor(parentTextZoomFactor(this)) 815 , m_textZoomFactor(parentTextZoomFactor(this))
813 , m_inViewSourceMode(false) 816 , m_inViewSourceMode(false)
814 { 817 {
815 if (isLocalRoot()) 818 if (isLocalRoot())
816 m_instrumentingAgents = InstrumentingAgents::create(); 819 m_instrumentingAgents = InstrumentingAgents::create();
817 else 820 else
818 m_instrumentingAgents = localFrameRoot()->m_instrumentingAgents; 821 m_instrumentingAgents = localFrameRoot()->m_instrumentingAgents;
819 } 822 }
820 823
821 } // namespace blink 824 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698