Permalink
Browse files

Remove the servo-gfx submodule

  • Loading branch information...
1 parent 5e70e3b commit 463b80090ce20a8c3cb79e43281c8925c2e05f39 @pcwalton pcwalton committed Nov 12, 2012
Showing with 5,535 additions and 25 deletions.
  1. +0 −3 .gitmodules
  2. +16 −3 Makefile.in
  3. +2 −1 configure
  4. +1 −17 mk/sub.mk
  5. +0 −1 src/servo-gfx
  6. BIN src/servo-gfx-2/JosefinSans-SemiBold.ttf
  7. +93 −0 src/servo-gfx-2/OFL.txt
  8. +18 −0 src/servo-gfx-2/color.rs
  9. +28 −0 src/servo-gfx-2/compositor.rs
  10. +117 −0 src/servo-gfx-2/display_list.rs
  11. +499 −0 src/servo-gfx-2/font.rs
  12. +124 −0 src/servo-gfx-2/font_context.rs
  13. +137 −0 src/servo-gfx-2/font_list.rs
  14. +12 −0 src/servo-gfx-2/fontconfig/font_list.rs
  15. +151 −0 src/servo-gfx-2/freetype/font.rs
  16. +33 −0 src/servo-gfx-2/freetype/font_context.rs
  17. +109 −0 src/servo-gfx-2/geometry.rs
  18. +43 −0 src/servo-gfx-2/image/base.rs
  19. +23 −0 src/servo-gfx-2/image/encode/tga.rs
  20. +102 −0 src/servo-gfx-2/image/holder.rs
  21. BIN src/servo-gfx-2/image/test.jpeg
  22. +9 −0 src/servo-gfx-2/native.rs
  23. +77 −0 src/servo-gfx-2/opts.rs
  24. +161 −0 src/servo-gfx-2/quartz/font.rs
  25. +12 −0 src/servo-gfx-2/quartz/font_context.rs
  26. +56 −0 src/servo-gfx-2/quartz/font_list.rs
  27. +105 −0 src/servo-gfx-2/render_context.rs
  28. +137 −0 src/servo-gfx-2/render_layers.rs
  29. +157 −0 src/servo-gfx-2/render_task.rs
  30. +29 −0 src/servo-gfx-2/resource/file_loader.rs
  31. +38 −0 src/servo-gfx-2/resource/http_loader.rs
  32. +1,101 −0 src/servo-gfx-2/resource/image_cache_task.rs
  33. +150 −0 src/servo-gfx-2/resource/local_image_cache.rs
  34. +157 −0 src/servo-gfx-2/resource/resource_task.rs
  35. +93 −0 src/servo-gfx-2/servo_gfx.rc
  36. +5 −0 src/servo-gfx-2/servo_gfx.rs
  37. +40 −0 src/servo-gfx-2/surface.rs
  38. +9 −0 src/servo-gfx-2/text.rs
  39. +624 −0 src/servo-gfx-2/text/glyph.rs
  40. +177 −0 src/servo-gfx-2/text/harfbuzz/shaper.rs
  41. +17 −0 src/servo-gfx-2/text/shaper.rs
  42. +203 −0 src/servo-gfx-2/text/text_run.rs
  43. +223 −0 src/servo-gfx-2/text/util.rs
  44. +59 −0 src/servo-gfx-2/util/cache.rs
  45. +164 −0 src/servo-gfx-2/util/range.rs
  46. +15 −0 src/servo-gfx-2/util/time.rs
  47. +107 −0 src/servo-gfx-2/util/url.rs
  48. +102 −0 src/servo-gfx-2/util/vec.rs
View
@@ -85,6 +85,3 @@
[submodule "src/skia"]
path = src/skia
url = git://github.com/mozilla-servo/skia.git
-[submodule "src/servo-gfx"]
- path = src/servo-gfx
- url = git://github.com/mozilla-servo/servo-gfx.git
View
@@ -130,12 +130,20 @@ endef
$(foreach submodule,$(CFG_SUBMODULES),\
$(eval $(call DEF_SUBMODULE_RULES,$(submodule))))
-RFLAGS_servo = $(strip $(CFG_RUSTC_FLAGS)) $(addprefix -L $(B)src/,$(DEPS_SUBMODULES))
+DONE_SUBMODULES = $(foreach dep,$(DEPS_SUBMODULES),$(DONE_$(dep)))
+
+RFLAGS_servo_gfx = $(strip $(CFG_RUSTC_FLAGS)) $(addprefix -L $(B)src/,$(DEPS_SUBMODULES))
+SRC_servo_gfx = $(call rwildcard,$(S)src/servo-gfx-2/,*.rs)
+CRATE_servo_gfx = $(S)src/servo-gfx-2/servo_gfx.rc
+DONE_servo_gfx = $(B)src/servo-gfx-2/libservogfx.dummy
+
+DEPS_servo_gfx = $(CRATE_servo_gfx) $(SRC_servo_gfx) $(DONE_SUBMODULES)
+
+RFLAGS_servo = $(strip $(CFG_RUSTC_FLAGS)) $(addprefix -L $(B)src/,$(DEPS_SUBMODULES)) -L $(B)src/servo-gfx-2
SRC_servo = $(call rwildcard,$(S)src/servo/,*.rs)
CRATE_servo = $(S)src/servo/servo.rc
-DONE_SUBMODULES = $(foreach dep,$(DEPS_SUBMODULES),$(DONE_$(dep)))
-DEPS_servo = $(CRATE_servo) $(SRC_servo) $(DONE_SUBMODULES)
+DEPS_servo = $(CRATE_servo) $(SRC_servo) $(DONE_SUBMODULES) $(DONE_servo_gfx)
# rules that depend on having correct meta-target vars (DEPS_CLEAN, DEPS_servo, etc)
include $(S)mk/check.mk
@@ -145,6 +153,11 @@ include $(S)mk/clean.mk
.PHONY: all
all: servo package
+# Servo helper libraries
+
+$(DONE_servo_gfx): $(DEPS_servo_gfx)
+ $(RUSTC) $(RFLAGS_servo_gfx) -o $@ $< && touch $@
+
# Servo binaries
servo: $(DEPS_servo)
View
@@ -344,7 +344,7 @@ step_msg "running submodule autoconf scripts"
(cd ${CFG_SRC_DIR}src/mozjs/js/src && "${CFG_AUTOCONF213}") || exit $?
-CFG_SUBMODULES="libwapcaplet rust-wapcaplet rust-harfbuzz rust-opengles skia rust-azure rust-cairo rust-stb-image rust-geom rust-glut rust-layers rust-http-client libparserutils libhubbub libcss rust-netsurfcss rust-css rust-hubbub sharegl rust-mozjs mozjs servo-gfx"
+CFG_SUBMODULES="libwapcaplet rust-wapcaplet rust-harfbuzz rust-opengles skia rust-azure rust-cairo rust-stb-image rust-geom rust-glut rust-layers rust-http-client libparserutils libhubbub libcss rust-netsurfcss rust-css rust-hubbub sharegl rust-mozjs mozjs"
if [ $CFG_OSTYPE = "darwin" ]
then
@@ -365,6 +365,7 @@ do
make_dir ${CFG_BUILD_DIR}src/${i}
done
+make_dir ${CFG_BUILD_DIR}src/servo-gfx-2
make_dir src/test/ref
# TODO: don't run configure on submodules unless necessary. For an example,
View
@@ -81,16 +81,6 @@ DEPS_libcss += \
libparserutils \
$(NULL)
-DEPS_servo-gfx += \
- rust-azure \
- rust-cairo \
- rust-freetype \
- rust-geom \
- rust-harfbuzz \
- rust-http-client \
- rust-stb-image \
- $(NULL)
-
# Platform-specific dependencies
ifeq ($(CFG_OSTYPE),darwin)
DEPS_rust-azure += \
@@ -105,7 +95,7 @@ DEPS_rust-cairo += \
rust-core-graphics \
$(NULL)
-DEPS_rust-io-surface += \
+dEPS_rust-io-surface += \
rust-core-foundation \
$(NULL)
@@ -129,12 +119,6 @@ DEPS_rust-layers += \
rust-core-text \
$(NULL)
-DEPS_servo-gfx += \
- rust-core-foundation \
- rust-core-graphics \
- rust-core-text \
- $(NULL)
-
endif
ifeq ($(CFG_OSTYPE),linux)
Submodule servo-gfx deleted from 08d11a
Binary file not shown.
View
@@ -0,0 +1,93 @@
+Copyright (c) 2009, 2010, 2011 Daniel Johnson (<il.basso.buffo@gmail.com>).
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+http://scripts.sil.org/OFL
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
View
@@ -0,0 +1,18 @@
+use azure::AzFloat;
+use AzColor = azure::azure_hl::Color;
+
+pub type Color = AzColor;
+
+pub fn rgb(r: u8, g: u8, b: u8) -> AzColor {
+ rgba(r, g, b, 1.0)
+}
+
+pub fn rgba(r: u8, g: u8, b: u8, a: float) -> AzColor {
+ AzColor {
+ r: (r as AzFloat) / (255.0 as AzFloat),
+ g: (g as AzFloat) / (255.0 as AzFloat),
+ b: (b as AzFloat) / (255.0 as AzFloat),
+ a: a as AzFloat
+ }
+}
+
@@ -0,0 +1,28 @@
+use azure::azure_hl::{DrawTarget};
+use geom::rect::Rect;
+
+struct LayerBuffer {
+ draw_target: DrawTarget,
+
+ // The rect in the containing RenderLayer that this represents.
+ rect: Rect<uint>,
+
+ // NB: stride is in pixels, like OpenGL GL_UNPACK_ROW_LENGTH.
+ stride: uint
+}
+
+/// A set of layer buffers. This is an atomic unit used to switch between the front and back
+/// buffers.
+struct LayerBufferSet {
+ buffers: ~[LayerBuffer]
+}
+
+/**
+The interface used to by the renderer to aquire draw targets for
+each rendered frame and submit them to be drawn to the display
+*/
+trait Compositor {
+ fn begin_drawing(next_dt: pipes::Chan<LayerBufferSet>);
+ fn draw(next_dt: pipes::Chan<LayerBufferSet>, +draw_me: LayerBufferSet);
+}
+
@@ -0,0 +1,117 @@
+use color::{Color, rgb};
+use geometry::Au;
+use image::base::Image;
+use render_context::RenderContext;
+use text::SendableTextRun;
+use util::range::Range;
+
+use azure::azure_hl::DrawTarget;
+use core::dvec::DVec;
+use clone_arc = std::arc::clone;
+use geom::Rect;
+use geom::Point2D;
+use std::arc::ARC;
+
+struct DisplayItemData {
+ bounds : Rect<Au>, // TODO: whose coordinate system should this use?
+}
+
+impl DisplayItemData {
+ static pure fn new(bounds: &Rect<Au>) -> DisplayItemData {
+ DisplayItemData { bounds: copy *bounds }
+ }
+}
+
+pub enum DisplayItem {
+ SolidColor(DisplayItemData, Color),
+ // TODO: need to provide spacing data for text run.
+ // (i.e, to support rendering of CSS 'word-spacing' and 'letter-spacing')
+ // TODO: don't copy text runs, ever.
+ Text(DisplayItemData, ~SendableTextRun, Range, Color),
+ Image(DisplayItemData, ARC<~image::base::Image>),
+ Border(DisplayItemData, Au, Color)
+}
+
+impl DisplayItem {
+ pure fn d(&self) -> &self/DisplayItemData {
+ match *self {
+ SolidColor(ref d, _) => d,
+ Text(ref d, _, _, _) => d,
+ Image(ref d, _) => d,
+ Border(ref d, _, _) => d
+ }
+ }
+
+ fn draw_into_context(&self, ctx: &RenderContext) {
+ match *self {
+ SolidColor(_, color) => ctx.draw_solid_color(&self.d().bounds, color),
+ Text(_, run, range, color) => {
+ let new_run = @run.deserialize(ctx.font_ctx);
+ let font = new_run.font;
+ let origin = self.d().bounds.origin;
+ let baseline_origin = Point2D(origin.x, origin.y + font.metrics.ascent);
+ font.draw_text_into_context(ctx, new_run, range, baseline_origin, color);
+ },
+ Image(_, ref img) => ctx.draw_image(self.d().bounds, clone_arc(img)),
+ Border(_, width, color) => ctx.draw_border(&self.d().bounds, width, color),
+ }
+
+ debug!("%?", {
+ ctx.draw_border(&self.d().bounds, Au::from_px(1), rgb(150, 150, 150));
+ () });
+ }
+
+ static pure fn new_SolidColor(bounds: &Rect<Au>, color: Color) -> DisplayItem {
+ SolidColor(DisplayItemData::new(bounds), color)
+ }
+
+ static pure fn new_Border(bounds: &Rect<Au>, width: Au, color: Color) -> DisplayItem {
+ Border(DisplayItemData::new(bounds), width, color)
+ }
+
+ static pure fn new_Text(bounds: &Rect<Au>,
+ run: ~SendableTextRun,
+ range: Range,
+ color: Color) -> DisplayItem {
+ Text(DisplayItemData::new(bounds), move run, range, color)
+ }
+
+ // ARC should be cloned into ImageData, but Images are not sendable
+ static pure fn new_Image(bounds: &Rect<Au>, image: ARC<~image::base::Image>) -> DisplayItem {
+ Image(DisplayItemData::new(bounds), move image)
+ }
+}
+
+// Dual-mode/freezable.
+pub struct DisplayList {
+ list: ~[~DisplayItem]
+}
+
+trait DisplayListMethods {
+ fn append_item(&mut self, item: ~DisplayItem);
+ fn draw_into_context(ctx: &RenderContext);
+}
+
+impl DisplayList {
+ static fn new() -> DisplayList {
+ DisplayList { list: ~[] }
+ }
+}
+
+impl DisplayList : DisplayListMethods {
+ fn append_item(&mut self, item: ~DisplayItem) {
+ // FIXME(Issue #150): crashes
+ //debug!("Adding display item %u: %?", self.len(), item);
+ self.list.push(move item);
+ }
+
+ fn draw_into_context(ctx: &RenderContext) {
+ debug!("beginning display list");
+ for self.list.each |item| {
+ // FIXME(Issue #150): crashes
+ //debug!("drawing %?", *item);
+ item.draw_into_context(ctx);
+ }
+ debug!("ending display list");
+ }
+}
Oops, something went wrong.

0 comments on commit 463b800

Please sign in to comment.