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

Side by Side Diff: content/browser/renderer_host/backing_store_mac.h

Issue 10548026: mac: Make dynamic DPI changes work. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_BACKING_STORE_MAC_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_BACKING_STORE_MAC_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_BACKING_STORE_MAC_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_BACKING_STORE_MAC_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/mac/scoped_cftyperef.h" 10 #include "base/mac/scoped_cftyperef.h"
11 #include "content/browser/renderer_host/backing_store.h" 11 #include "content/browser/renderer_host/backing_store.h"
12 12
13 class BackingStoreMac : public BackingStore { 13 class BackingStoreMac : public BackingStore {
14 public: 14 public:
15 // |size| is in view units, |device_scale_factor| is the backingScaleFactor. 15 // |size| is in view units, |device_scale_factor| is the backingScaleFactor.
16 // The pixel size of the backing store is size.Scale(device_scale_factor). 16 // The pixel size of the backing store is size.Scale(device_scale_factor).
17 BackingStoreMac(content::RenderWidgetHost* widget, 17 BackingStoreMac(content::RenderWidgetHost* widget,
18 const gfx::Size& size, 18 const gfx::Size& size,
19 float device_scale_factor); 19 float device_scale_factor);
20 virtual ~BackingStoreMac(); 20 virtual ~BackingStoreMac();
21 21
22 // A CGLayer that stores the contents of the backing store, cached in GPU 22 // A CGLayer that stores the contents of the backing store, cached in GPU
23 // memory if possible. 23 // memory if possible.
24 CGLayerRef cg_layer() { return cg_layer_; } 24 CGLayerRef cg_layer() { return cg_layer_; }
25 25
26 // A CGBitmapContext that stores the contents of the backing store if the 26 // A CGBitmapContext that stores the contents of the backing store if the
27 // corresponding Cocoa view has not been inserted into an NSWindow yet. 27 // corresponding Cocoa view has not been inserted into an NSWindow yet.
28 CGContextRef cg_bitmap() { return cg_bitmap_; } 28 CGContextRef cg_bitmap() { return cg_bitmap_; }
29 29
30 void ScaleFactorChanged(float device_scale_factor);
31
30 // BackingStore implementation. 32 // BackingStore implementation.
31 virtual size_t MemorySize() OVERRIDE; 33 virtual size_t MemorySize() OVERRIDE;
32 virtual void PaintToBackingStore( 34 virtual void PaintToBackingStore(
33 content::RenderProcessHost* process, 35 content::RenderProcessHost* process,
34 TransportDIB::Id bitmap, 36 TransportDIB::Id bitmap,
35 const gfx::Rect& bitmap_rect, 37 const gfx::Rect& bitmap_rect,
36 const std::vector<gfx::Rect>& copy_rects, 38 const std::vector<gfx::Rect>& copy_rects,
37 float scale_factor, 39 float scale_factor,
38 const base::Closure& completion_callback, 40 const base::Closure& completion_callback,
39 bool* scheduled_completion_callback) OVERRIDE; 41 bool* scheduled_completion_callback) OVERRIDE;
(...skipping 21 matching lines...) Expand all
61 base::mac::ScopedCFTypeRef<CGContextRef> cg_bitmap_; 63 base::mac::ScopedCFTypeRef<CGContextRef> cg_bitmap_;
62 base::mac::ScopedCFTypeRef<CGLayerRef> cg_layer_; 64 base::mac::ScopedCFTypeRef<CGLayerRef> cg_layer_;
63 65
64 // Number of physical pixels per view unit. This is 1 or 2 in practice. 66 // Number of physical pixels per view unit. This is 1 or 2 in practice.
65 float device_scale_factor_; 67 float device_scale_factor_;
66 68
67 DISALLOW_COPY_AND_ASSIGN(BackingStoreMac); 69 DISALLOW_COPY_AND_ASSIGN(BackingStoreMac);
68 }; 70 };
69 71
70 #endif // CONTENT_BROWSER_RENDERER_HOST_BACKING_STORE_MAC_H_ 72 #endif // CONTENT_BROWSER_RENDERER_HOST_BACKING_STORE_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698