Commit fb3cc061 authored by jamesr@chromium.org's avatar jamesr@chromium.org

Mojom interface for Surfaces service

Review URL: https://codereview.chromium.org/342543002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278060 0039d316-1c4b-4281-b951-d872f2087c98
parent 3bb37114
......@@ -359,6 +359,23 @@
}]
],
},
{
'target_name': 'mojo_surfaces_bindings',
'type': 'static_library',
'sources': [
'services/public/interfaces/surfaces/surfaces.mojom',
'services/public/interfaces/surfaces/surface_id.mojom',
'services/public/interfaces/surfaces/quads.mojom',
],
'includes': [ 'public/tools/bindings/mojom_bindings_generator.gypi' ],
'export_dependent_settings': [
'mojo_cpp_bindings',
],
'dependencies': [
'mojo_cpp_bindings',
'mojo_geometry_bindings',
],
},
{
'target_name': 'mojo_test_service_bindings',
'type': 'static_library',
......
......@@ -9,6 +9,11 @@ struct Point {
int32 y;
};
struct PointF {
float x;
float y;
};
struct Size {
int32 width;
int32 height;
......@@ -21,4 +26,9 @@ struct Rect {
int32 height;
};
struct Transform {
// Should have exactly 16 entries.
float[] matrix;
};
}
// Copyright 2014 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.
import "../geometry/geometry.mojom"
import "surface_id.mojom"
module mojo.surfaces {
struct Color {
uint32 rgba;
};
// TODO(jamesr): Populate subtype fields.
struct CheckerboardQuadState {};
struct DebugBorderQuadState {};
struct IoSurfaceContentQuadState {};
struct RenderPassQuadState {};
struct SolidColorQuadState {
Color color;
};
struct SurfaceQuadState {
SurfaceId surface;
};
struct TextureQuadState {
uint32 resource_id;
bool premultiplied_alpha;
mojo.PointF uv_top_left;
mojo.PointF uv_bottom_right;
Color background_color;
// Should have exactly 4 entries.
float[] vertex_opacity;
bool flipped;
};
struct TiledContentQuadState {};
struct StreamVideoQuadState {};
struct YUVVideoQuadState {};
enum Material {
CHECKERBOARD = 1,
DEBUG_BORDER,
IO_SURFACE_CONTENT,
RENDER_PASS,
SOLID_COLOR,
STREAM_VIDEO_CONTENT,
SURFACE_CONTENT,
TEXTURE_CONTENT,
TILED_CONTENT,
YUV_VIDEO_CONTENT,
};
struct Quad {
Material material;
// This rect, after applying the quad_transform(), gives the geometry that
// this quad should draw to. This rect lives in content space.
mojo.Rect rect;
// This specifies the region of the quad that is opaque. This rect lives in
// content space.
mojo.Rect opaque_rect;
// Allows changing the rect that gets drawn to make it smaller. This value
// should be clipped to |rect|. This rect lives in content space.
mojo.Rect visible_rect;
// Allows changing the rect that gets drawn to make it smaller. This value
// should be clipped to |rect|. This rect lives in content space.
bool needs_blending;
// Index into the containing pass' shared quad state array which has state
// (transforms etc) shared by multiple quads.
int32 shared_quad_state_index;
// Only one of the following will be set, depending on the material.
CheckerboardQuadState checkerboard_quad_state;
DebugBorderQuadState debug_border_quad_state;
IoSurfaceContentQuadState io_surface_quad_state;
RenderPassQuadState render_pass_quad_state;
SolidColorQuadState solid_color_quad_state;
SurfaceQuadState surface_quad_state;
TextureQuadState texture_quad_state;
TiledContentQuadState tiled_content_quad_state;
StreamVideoQuadState stream_video_quad_state;
YUVVideoQuadState yuv_video_quad_state;
};
enum SkXfermode {
kClear_Mode = 0, //!< [0, 0]
kSrc_Mode, //!< [Sa, Sc]
kDst_Mode, //!< [Da, Dc]
kSrcOver_Mode, //!< [Sa + Da - Sa*Da, Rc = Sc + (1 - Sa)*Dc]
kDstOver_Mode, //!< [Sa + Da - Sa*Da, Rc = Dc + (1 - Da)*Sc]
kSrcIn_Mode, //!< [Sa * Da, Sc * Da]
kDstIn_Mode, //!< [Sa * Da, Sa * Dc]
kSrcOut_Mode, //!< [Sa * (1 - Da), Sc * (1 - Da)]
kDstOut_Mode, //!< [Da * (1 - Sa), Dc * (1 - Sa)]
kSrcATop_Mode, //!< [Da, Sc * Da + (1 - Sa) * Dc]
kDstATop_Mode, //!< [Sa, Sa * Dc + Sc * (1 - Da)]
kXor_Mode, //!< [Sa + Da - 2 * Sa * Da, Sc * (1 - Da) + (1 - Sa) * Dc]
kPlus_Mode, //!< [Sa + Da, Sc + Dc]
kModulate_Mode, // multiplies all components (= alpha and color)
// Following blend modes are defined in the CSS Compositing standard:
// https://dvcs.w3.org/hg/FXTF/rawfile/tip/compositing/index.html#blending
kScreen_Mode,
kLastCoeffMode = kScreen_Mode,
kOverlay_Mode,
kDarken_Mode,
kLighten_Mode,
kColorDodge_Mode,
kColorBurn_Mode,
kHardLight_Mode,
kSoftLight_Mode,
kDifference_Mode,
kExclusion_Mode,
kMultiply_Mode,
kLastSeparableMode = kMultiply_Mode,
kHue_Mode,
kSaturation_Mode,
kColor_Mode,
kLuminosity_Mode,
kLastMode = kLuminosity_Mode
};
struct SharedQuadState {
// Transforms from quad's original content space to its target content space.
mojo.Transform content_to_target_transform;
// This size lives in the content space for the quad's originating layer.
mojo.Size content_bounds;
// This rect lives in the content space for the quad's originating layer.
mojo.Rect visible_content_rect;
// This rect lives in the target content space.
mojo.Rect clip_rect;
bool is_clipped;
float opacity;
SkXfermode blend_mode;
};
struct Pass {
int32 id;
mojo.Rect output_rect;
mojo.Rect damage_rect;
mojo.Transform transform_to_root_target;
bool has_transparent_pixels;
Quad[] quads;
SharedQuadState[] shared_quad_states;
};
}
// Copyright 2014 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.
module mojo.surfaces {
struct SurfaceId {
int32 id;
};
}
// Copyright 2014 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.
import "../geometry/geometry.mojom"
import "quads.mojom"
import "surface_id.mojom"
module mojo.surfaces {
enum ResourceFormat {
RGBA_8888,
RGBA_4444,
BGRA_8888,
LUMINANCE_8,
RGB_565,
ETC1,
};
struct Mailbox {
// Should have exactly 64 entries.
int8[] name;
};
struct MailboxHolder {
Mailbox mailbox;
uint32 texture_target;
uint32 sync_point;
};
struct TransferableResource {
uint32 id;
ResourceFormat format;
uint32 filter;
mojo.Size size;
MailboxHolder mailbox_holder;
bool is_repeated;
bool is_software;
};
struct Frame {
TransferableResource[] resources;
Pass[] passes;
};
interface SurfaceClient {
ReturnResources(TransferableResource[] resources);
};
[client=SurfaceClient]
interface Surface {
CreateSurface(SurfaceId id, mojo.Size size);
SubmitFrame(SurfaceId id, Frame frame);
DestroySurface(SurfaceId id);
};
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment