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

Side by Side Diff: sky/engine/core/fetch/ImageResource.h

Issue 711203002: Remove zoom() and effectiveZoom(). (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 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
« no previous file with comments | « sky/engine/core/dom/Element.cpp ('k') | sky/engine/core/fetch/ImageResource.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller <mueller@kde.org> 3 Copyright (C) 2001 Dirk Mueller <mueller@kde.org>
4 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 4 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
5 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 5 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
6 6
7 This library is free software; you can redistribute it and/or 7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public 8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either 9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version. 10 version 2 of the License, or (at your option) any later version.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 virtual void load(ResourceFetcher*, const ResourceLoaderOptions&) override; 54 virtual void load(ResourceFetcher*, const ResourceLoaderOptions&) override;
55 55
56 blink::Image* image(); // Returns the nullImage() if the image is not availa ble yet. 56 blink::Image* image(); // Returns the nullImage() if the image is not availa ble yet.
57 blink::Image* imageForRenderer(const RenderObject*); // Returns the nullImag e() if the image is not available yet. 57 blink::Image* imageForRenderer(const RenderObject*); // Returns the nullImag e() if the image is not available yet.
58 bool hasImage() const { return m_image.get(); } 58 bool hasImage() const { return m_image.get(); }
59 bool currentFrameKnownToBeOpaque(const RenderObject*); // Side effect: ensur es decoded image is in cache, therefore should only be called when about to draw the image. 59 bool currentFrameKnownToBeOpaque(const RenderObject*); // Side effect: ensur es decoded image is in cache, therefore should only be called when about to draw the image.
60 60
61 static std::pair<blink::Image*, float> brokenImage(float deviceScaleFactor); // Returns an image and the image's resolution scale factor. 61 static std::pair<blink::Image*, float> brokenImage(float deviceScaleFactor); // Returns an image and the image's resolution scale factor.
62 bool willPaintBrokenImage() const; 62 bool willPaintBrokenImage() const;
63 63
64 bool canRender(const RenderObject& renderer, float multiplier) { return !err orOccurred() && !imageSizeForRenderer(&renderer, multiplier).isEmpty(); } 64 bool canRender(const RenderObject& renderer) { return !errorOccurred() && !i mageSizeForRenderer(&renderer).isEmpty(); }
65 65
66 void setContainerSizeForRenderer(const ImageResourceClient*, const IntSize&, float); 66 void setContainerSizeForRenderer(const ImageResourceClient*, const IntSize&) ;
67 bool usesImageContainerSize() const; 67 bool usesImageContainerSize() const;
68 bool imageHasRelativeWidth() const; 68 bool imageHasRelativeWidth() const;
69 bool imageHasRelativeHeight() const; 69 bool imageHasRelativeHeight() const;
70 // The device pixel ratio we got from the server for this image, or 1.0. 70 // The device pixel ratio we got from the server for this image, or 1.0.
71 float devicePixelRatioHeaderValue() const { return m_devicePixelRatioHeaderV alue; } 71 float devicePixelRatioHeaderValue() const { return m_devicePixelRatioHeaderV alue; }
72 bool hasDevicePixelRatioHeaderValue() const { return m_hasDevicePixelRatioHe aderValue; } 72 bool hasDevicePixelRatioHeaderValue() const { return m_hasDevicePixelRatioHe aderValue; }
73 73
74 enum SizeType { 74 enum SizeType {
75 NormalSize, // Report the size of the image associated with a certain re nderer 75 NormalSize, // Report the size of the image associated with a certain re nderer
76 IntrinsicSize // Report the intrinsic size, i.e. ignore whatever has bee n set extrinsically. 76 IntrinsicSize // Report the intrinsic size, i.e. ignore whatever has bee n set extrinsically.
77 }; 77 };
78 // This method takes a zoom multiplier that can be used to increase the natu ral size of the image by the zoom. 78 LayoutSize imageSizeForRenderer(const RenderObject*, SizeType = NormalSize); // returns the size of the complete image.
79 LayoutSize imageSizeForRenderer(const RenderObject*, float multiplier, SizeT ype = NormalSize); // returns the size of the complete image.
80 void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHei ght, FloatSize& intrinsicRatio); 79 void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHei ght, FloatSize& intrinsicRatio);
81 80
82 virtual void didAddClient(ResourceClient*) override; 81 virtual void didAddClient(ResourceClient*) override;
83 virtual void didRemoveClient(ResourceClient*) override; 82 virtual void didRemoveClient(ResourceClient*) override;
84 83
85 virtual void allClientsRemoved() override; 84 virtual void allClientsRemoved() override;
86 85
87 virtual void appendData(const char*, int) override; 86 virtual void appendData(const char*, int) override;
88 virtual void error(Resource::Status) override; 87 virtual void error(Resource::Status) override;
89 virtual void responseReceived(const ResourceResponse&) override; 88 virtual void responseReceived(const ResourceResponse&) override;
(...skipping 22 matching lines...) Expand all
112 111
113 void setCustomAcceptHeader(); 112 void setCustomAcceptHeader();
114 void createImage(); 113 void createImage();
115 void updateImage(bool allDataReceived); 114 void updateImage(bool allDataReceived);
116 void clearImage(); 115 void clearImage();
117 // If not null, changeRect is the changed part of the image. 116 // If not null, changeRect is the changed part of the image.
118 void notifyObservers(const IntRect* changeRect = 0); 117 void notifyObservers(const IntRect* changeRect = 0);
119 118
120 virtual void switchClientsToRevalidatedResource() override; 119 virtual void switchClientsToRevalidatedResource() override;
121 120
122 typedef pair<IntSize, float> SizeAndZoom; 121 typedef HashMap<const ImageResourceClient*, IntSize> ContainerSizeRequests;
123 typedef HashMap<const ImageResourceClient*, SizeAndZoom> ContainerSizeReques ts;
124 ContainerSizeRequests m_pendingContainerSizeRequests; 122 ContainerSizeRequests m_pendingContainerSizeRequests;
125 float m_devicePixelRatioHeaderValue; 123 float m_devicePixelRatioHeaderValue;
126 124
127 RefPtr<blink::Image> m_image; 125 RefPtr<blink::Image> m_image;
128 bool m_loadingMultipartContent; 126 bool m_loadingMultipartContent;
129 bool m_hasDevicePixelRatioHeaderValue; 127 bool m_hasDevicePixelRatioHeaderValue;
130 }; 128 };
131 129
132 DEFINE_RESOURCE_TYPE_CASTS(Image); 130 DEFINE_RESOURCE_TYPE_CASTS(Image);
133 131
134 } 132 }
135 133
136 #endif 134 #endif
OLDNEW
« no previous file with comments | « sky/engine/core/dom/Element.cpp ('k') | sky/engine/core/fetch/ImageResource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698