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

Unified Diff: blimp/client/compositor/blimp_compositor_android.h

Issue 1295243003: Initial commit of the blimp/ folder and target (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address more nits Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: blimp/client/compositor/blimp_compositor_android.h
diff --git a/blimp/client/compositor/blimp_compositor_android.h b/blimp/client/compositor/blimp_compositor_android.h
new file mode 100644
index 0000000000000000000000000000000000000000..10500b809285c6af23e83cbcd49af7f622de33db
--- /dev/null
+++ b/blimp/client/compositor/blimp_compositor_android.h
@@ -0,0 +1,77 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BLIMP_CLIENT_COMPOSITOR_BLIMP_COMPOSITOR_ANDROID_H_
+#define BLIMP_CLIENT_COMPOSITOR_BLIMP_COMPOSITOR_ANDROID_H_
+
+#include "base/android/jni_android.h"
+#include "base/macros.h"
+#include "blimp/client/compositor/blimp_compositor.h"
+#include "ui/gfx/geometry/size.h"
+#include "ui/gfx/native_widget_types.h"
+
+namespace base {
+class SingleThreadTaskRunner;
+class Thread;
+}
+
+namespace cc {
+class LayerTreeHost;
+}
+
+namespace blimp {
+
+// An Android specific version of the BlimpCompositor. This class builds a
+// gfx::AcceleratedWidget out of an Android SurfaceView's surface.
+class BlimpCompositorAndroid : public BlimpCompositor {
+ public:
+ // |physical_size| is the total display area including system decorations (see
+ // android.view.Display.getRealSize()). |display_size| is the total display
+ // area not including system decorations (see android.view.Display.getSize()).
+ // |dp_to_pixel| is the scale factor that is required to move from dp
+ // (device pixels) to pixels.
Wez 2015/09/03 18:26:11 See comment on the BlimpView and note that you've
David Trainor- moved to gerrit 2015/09/03 19:06:01 Done.
+ static scoped_ptr<BlimpCompositorAndroid> Create(
+ const gfx::Size& physical_size,
+ const gfx::Size& display_size,
+ float device_scale_factor);
+
+ ~BlimpCompositorAndroid() override;
+
+ // Takes a reference to the ANativeWindow backing |jsurface|, to use to render
+ // to, and releases any previously-held reference.
+ void SetSurface(JNIEnv* env, jobject jsurface);
+
+ protected:
+ // |physical_size| is the total display area including system decorations (see
+ // android.view.Display.getRealSize()). |display_size| is the total display
+ // area not including system decorations (see android.view.Display.getSize()).
+ // |dp_to_pixel| is the scale factor that is required to move from dp
+ // (device pixels) to pixels.
Wez 2015/09/03 18:26:11 This is a copy of the comment on Create() - it doe
David Trainor- moved to gerrit 2015/09/03 19:06:01 Yeah my bad. Fixed this.
+ BlimpCompositorAndroid(const gfx::Size& device_size,
+ bool real_size_supported,
+ float device_scale_factor);
+
+ // BlimpCompositor implementation.
+ gfx::AcceleratedWidget GetWindow() override;
+ void GenerateLayerTreeSettings(cc::LayerTreeSettings* settings);
+
+ private:
+ // Used to determine tile size for the compositor's rastered tiles. For a
+ // device of width X height |portrait_width_| will be min(width, height) and
+ // |landscape_width_| will be max(width, height).
+ int portrait_width_;
+ int landscape_width_;
+
+ // True if the |portrait_width_| and |landscape_width_| represent the device's
+ // physical dimensions, including any area occupied by system decorations.
+ bool real_size_supported_;
+
+ gfx::AcceleratedWidget window_;
+
+ DISALLOW_COPY_AND_ASSIGN(BlimpCompositorAndroid);
+};
+
+} // namespace blimp
+
+#endif // BLIMP_CLIENT_COMPOSITOR_BLIMP_COMPOSITOR_ANDROID_H_

Powered by Google App Engine
This is Rietveld 408576698